C
chenxinhlj
Description
a hero invented a new style of cross-bow that could shoot
consecutively. The arrow could hit the eagle exactly if only the arrow
could reach the height of the eagle. However, there was a flaw of the
corss-bow: only the first arrow could reach any height and the height
that the arrow shot latter could reach was always lower than the
former one. Actually, the higher the cross-bow can hit, the better the
performance it is. One day, the hero happened to see a crowd of eagles
flying through the sky. Now you have to work out a program that helps
Guo Jing to count how many eagles he can shoot down at most.
Input
This problem contains multiple test cases. For each test case, input
the number of eagles n (1<=n<=1000) in the first line, then input the
height h of each eagle (1<=h<=10000) in another new line with a blank
between every two of them.
Output
Please calculate the maximal number of eagles m that can be shot down
by the cross-bow in the first line, and then output the height of the
each eagle that have been shot down and separated by blanks in the
second line.
Sample Input
8
389 207 155 300 299 170 158 65
2
100 105
Sample Output
6
389 300 299 170 158 65
1
105
a hero invented a new style of cross-bow that could shoot
consecutively. The arrow could hit the eagle exactly if only the arrow
could reach the height of the eagle. However, there was a flaw of the
corss-bow: only the first arrow could reach any height and the height
that the arrow shot latter could reach was always lower than the
former one. Actually, the higher the cross-bow can hit, the better the
performance it is. One day, the hero happened to see a crowd of eagles
flying through the sky. Now you have to work out a program that helps
Guo Jing to count how many eagles he can shoot down at most.
Input
This problem contains multiple test cases. For each test case, input
the number of eagles n (1<=n<=1000) in the first line, then input the
height h of each eagle (1<=h<=10000) in another new line with a blank
between every two of them.
Output
Please calculate the maximal number of eagles m that can be shot down
by the cross-bow in the first line, and then output the height of the
each eagle that have been shot down and separated by blanks in the
second line.
Sample Input
8
389 207 155 300 299 170 158 65
2
100 105
Sample Output
6
389 300 299 170 158 65
1
105