#CCBCHHAI0000018. Bộ đếm nhiệt độ hợp lệ (First Valid Temperature and Read Count)
Bộ đếm nhiệt độ hợp lệ (First Valid Temperature and Read Count)
First Valid Temperature and Read Count
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read integer temperatures until the first value in the inclusive interval . Print the accepted temperature and the total number of reads through and including it. Both -50 and 50 are valid.
Input
An integer sequence whose last value is the first valid temperature, with no following data.
Output
Print the first valid temperature and total number of reads, separated by a space.
Subtasks
- Subtask 1 (20%): At most 5 integers, each of absolute value at most 60.
- 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
-51 60 -50
Output
-50 3
Explanation
-51 and 60 are invalid; -50 is accepted on the third read.
Example 2
Input
50
Output
50 1
Explanation
50 is valid on the first read.