Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Missile Defence System
Description To play against the threats of malicious countries nearby, Country R has updated their missile defence system. The new type system can bring down a series of missiles as long as they are coming in ascending order by altitude or descending order by altitude. Given the heights of a sequence of coming missiles, the general wants to know how many sets of the new type systems are needed to bring down all of them. Input The input consists of several test cases. The first line of each test case contains an integer Output For each test case output a single line containing the number of systems needed. Sample Input 5 3 5 2 4 1 0 Sample Output 2 Hint Two sets of systems are needed for the sample. One brings down 3, 4 and the other brings down 5, 2, 1. Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator