#CCBCHHAI0000015. Tuổi đầu tiên đúng miền (First Valid Age)
Tuổi đầu tiên đúng miền (First Valid Age)
First Valid Age
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
A valid age is an integer in the closed interval . Read values in order, stop at the first valid age, and print only that value. Both zero and 120 are accepted.
Input
A sequence of integers whose last value is the first valid age; no values follow.
Output
Print one integer, the first valid age.
Subtasks
- Subtask 1 (20%): At most 5 integers, each of absolute value at most 150.
- Subtask 2 (30%): At most 100 integers, each of absolute value at most 1000.
- Subtask 3 (50%): At most 100001 integers, each of absolute value at most 1000000.
Examples
Example 1
Input
-1 150 0
Output
0
Explanation
-1 is negative, 150 is above 120, and 0 is a valid lower endpoint.
Example 2
Input
120
Output
120
Explanation
The first value, 120, is accepted after one read.