See the original article https://dyingdown.github.io/2019/11/17/AtCoder-4871-Lower/
There are $N$ squares arranged in a row from left to right.
The height of the $i-th$ square from the left is $H_i$.
You will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.
Find the maximum number of times you can move.
Input is given from Standard Input in the following format:
1 | N |
Print the maximum number of times you can move.
1 | 5 |
1 | 2 |
By landing on the third square from the left, you can move to the right twice.
1 | 7 |
1 | 3 |
By landing on the fourth square from the left, you can move to the right three times.
1 | 4 |
1 | 0 |
Since the data is small and the time is long, you can use violent methods.
If the this number is no smaller than the previous number, answer = answer + 1;
Else answer = 0
The max number = max(max number, answer).
1 |
|