VM7WC '15 #2 Bronze - Recruits!

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Fire Lord Ozai, who is also known for being a Joker (tell me if you get this reference!), finds the number 41 extremely funny. He has lined up N of his citizens with the intention of recruiting some of them for his army. When looking at a certain soldier, Ozai will consider him ugly if he and his adjacent soldiers in line are all less than or equal to a height of 41. Ozai needs to figure out just how ugly his potential recruits are. Help Ozai count the number of ugly soldiers in line.

Input Specification

The first line will contain the number of soldiers, N (1 \le N \le 20).

The next N lines will contain the heights of all the soldiers in the order they are standing in line.

Output Specification

Print the number of ugly soldiers in line.

Sample Input

3
30
25
50

Sample Output

1

Explanation for Sample Output

Only the first soldier is ugly.


Comments


  • -5
    belowthebelt  commented on May 3, 2015, 7:40 a.m. edited

    This comment is hidden due to too much negative feedback. Show it anyway.


    • 2
      println_hi_  commented on Oct. 21, 2016, 3:00 p.m.

      I feel like that wouldn't be right, to check circularly. If so then the solider at 30 would be adjacent to 50(>41), not making it ugly and 25 is already not ugly meaning their are no ugly soldiers


    • 2
      Anix55  commented on Nov. 25, 2015, 8:39 p.m.

      do you mean that the first person's adjacent soldiers are #2 and last person in line?