Hide
Problem A
Maximum Number
Design an algorithm that finds the maximum positive integer input by a user.
The user repeatedly inputs numbers until a negative value is entered.
Input
Input consists of $n \ge 2$ lines. Line $i$ contains one integer, $a_i$, where $0 \le a_i \le 10\, 000$ for all $i < n$, and $-10\, 000 \le a_n < 0$.
Output
Output consists of one integer, the maximum integer input.
Sample Input 1 | Sample Output 1 |
---|---|
5 7 2 4 9 11 8 -1 |
11 |
Sample Input 2 | Sample Output 2 |
---|---|
21 19 16 46 78 23 99 34 23 -5 |
99 |