#t365. 拦截导弹问题
拦截导弹问题
Missile Interception (Minimum Systems)
Problem Description
A country has developed a missile interception system to defend against enemy missile attacks. However, this system has a flaw: while its first shell can reach any altitude, every subsequent shell cannot fly higher than the previous one.
One day, radar detected incoming enemy missiles. Since the system is still in the trial phase, a single system may not be able to intercept all the missiles.
The radar reports the incoming heights of the missiles in order (each height is a positive integer not greater than ). Compute the minimum number of such interception systems needed to intercept all missiles.
Input Format
A single line containing heights given in order .
Output Format
Output the minimum number of systems needed to intercept all missiles.
Sample Input
389 207 155 300 299 170 158 65
Sample Output
2
Constraints
Each missile height is a positive integer ; .
Time limit 1s, memory limit 1024KiB for each test case.
Hint
Example: missiles of heights can all be intercepted by a single system, so .