#CCBCHHAI0000016. Lấy dữ liệu hợp lệ đầu tiên (First Valid Value and Read Count)
Lấy dữ liệu hợp lệ đầu tiên (First Valid Value and Read Count)
First Valid Value and Read Count
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read integers up to and including the first value in (inclusive). Print that value and the number of reads including the accepted value. Earlier invalid values may be negative, zero, or above nine.
Input
At most integers within ; the final one is the first value in .
Output
Print two integers separated by a space: the first accepted value and the total number read.
Subtasks
- Subtask 1 (20%): At most 5 integers, each of absolute value at most 10.
- Subtask 2 (30%): At most 100 integers, each of absolute value at most 100.
- Subtask 3 (50%): At most 10000 integers, each of absolute value at most 100.
Examples
Example 1
Input
-1 0 12 7
Output
7 4
Explanation
The first three values -1, 0, 12 are invalid; 7 is accepted on the fourth read.
Example 2
Input
1
Output
1 1
Explanation
One is accepted at the first read; the count is one.