GFSSOC '14 Winter J1 - Flying Plushies

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 2.0s
Memory limit: 16M

Authors:
Problem type

Griffy is flying to Don Mills C.I. to make friends (after Glenforest's defeat in ECOO)! Griffy would like to fly at exactly N meters off the ground (the most relaxing height). However, Don Mills (being a weird school) recently installed M giant cat girl plushies in a line (right on Griffy's course too!). Each plushie i has a height of H_i, and spans from the ground to its height inclusive. Determine how many plushies Griffy will fly into, assuming he will fly in a straight line at a constant height.

Input Specification

The first line will contain a single integer N (1 \le N \le 200).

The second line will contain a single integer M (1 \le M \le 200).

The next M lines will contain values of H_i (1 \le H_i \le 400).

Output Specification

Output one line, the number of plushies that Griffy will fly into.

Sample Input

5
3
1
7
5

Sample Output

2

Comments


  • 0
    Fares_X  commented on Jan. 12, 2023, 12:17 a.m.

    It was a weird problem.


  • 0
    panzer_shrek  commented on March 24, 2022, 1:33 a.m.

    Interestingly the last 4 cases returned NumberFormatException and further testing revealed null inputs for those cases, even though my program passed the sample input and the other cases. Test cases are written wrong, perhaps? Or do I have to consider null as a possible input and compensate for it?


    • 0
      Spitfire720  commented on March 24, 2022, 3:43 p.m.

      Not quite sure if this will solve it, but a byte can only handle values up to 128. The maximum output can be 200.


      • 0
        panzer_shrek  commented on March 24, 2022, 8:11 p.m.

        Changed to all shorts but still didn't work. I think it's the problem with the test cases.


        • 0
          Spitfire720  commented on March 24, 2022, 9:43 p.m.

          There's still a byte keyword in your code


          • 0
            panzer_shrek  commented on March 24, 2022, 9:52 p.m.

            My stupidity is my downfall... Forgot that byte only goes to 127... I'll leave this here so future people don't mess up at this point. And yup it works now. Thanks.


  • 7
    0Power10  commented on July 15, 2021, 8:20 p.m.

    I agree, definitely a weird school.