The Longest Slump
Fenwick Mill's press has an hourly output target, and an hour finishing below it is a slump hour. The plant manager does not want a tally of them: three bad hours scattered through a shift is ordinary variation, while three back to back means the line actually stopped and somebody should have called it in. An hour that lands exactly on target is not a slump.
Task: Print the length of the longest unbroken run of slump hours.
Input
The first line holds the target, a number. The second line holds an integer n, the number of hours. Each of the next n lines holds one hour's output.
Output
One line: a whole number. Print 0 when no hour fell below the target at all.
Example:
Input:
5
5
6
3
4
7
2
Output:
2
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in