The fellowship of the ring
Time limit1sMemory limit256 MB
Count how many of the P punch heights fall within the fair range from waist height W to neck height N.
- Level
Easy1 of 10
- Topics
- Array
- Solved
- No attempts yet
Problem
Boxing is a rough sport. To balance that, friendly matches follow a code of conduct that keeps the fight civil. The best known rule of that code is to never hit the opponent below the waist or above the neck.
You are given the waist height and the neck height of the opponent, together with the heights of the punches that were thrown. Count how many of those punches follow the rule. A punch is fair when its height is at least the waist height and at most the neck height.
Input
The first line contains three integers , and : the waist height of the opponent, the neck height of the opponent, and the number of punches thrown (, ).
The second line contains integers (), the heights of the punches. All heights are given in centimetres.
Output
Print one line with the number of fair punches.