ENIGMA-0x02 (2024) - S1 (Christmas treats)

View as PDF

Submit solution

Points: 100 (partial)
Time limit: 1.0s
Memory limit: 16M

Authors:
Problem types
Allowed languages
Blockly, C, C++, Java, Pascal, Python

Christmas Treats

In preparation for celebrating Christmas, Toto's and Annoula's mom made a bunch of sweets:
melomakarona (1), kourabiedes (2), koulourakia (3), diples (4), and chocolates (5).

After completing them, she packed them in large boxes to give as gifts to the guests.
Before starting to decorate the gift boxes, she realized she hadn't noted how many pieces of a particular sweet were in each box.
This was quite important because each guest had a different favorite sweet, and each was assigned a different gift box.
Immediately, Annoula and Totos sprang into action and started counting how many pieces of a particular type of sweet each box contained.

We want to write a program that will read two positive integers, N and S, from the input STDIN, separated by a space (' '), followed by S positive integers S_i, separated by a space (' '). The program will print the count of the occurrences of N among the S numbers.

  • N represents the sweet for which we need to count how many times it appears in the box.
  • S represents the total number of sweets in the box.
  • S_i represents each sweet inside the box.

Note! Each input or output line must end with a newline character ('\n').

Example

Input (STDIN)

1 10
2 1 1 3 1 5 1 2 1 1

Output (STDOUT)

6
Explanation of the Example:

Totos and Annoula are looking to see how many pieces of sweet 1 there are among the 10 sweets in the box.
Counting, they find that there are 6 such sweets.


Comments

There are no comments at the moment.