#CCBCHHAI0000024. Hai điểm liên tiếp hợp lệ (Two Accepted Scores in a Stream)
Hai điểm liên tiếp hợp lệ (Two Accepted Scores in a Stream)
Two Accepted Scores in a Stream
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read a stream of integer scores. A score is accepted when it belongs to the closed interval . Ignore rejected scores, take the first two accepted scores, and print their sum. The two accepted scores need not be adjacent in the original stream.
Input
A whitespace-separated sequence of integers in , containing at least two accepted scores. The last integer is the second accepted score.
Output
Print the integer sum of exactly the first two accepted scores on one line.
Subtasks
- Subtask 1 (20%): At most values in .
- Subtask 2 (30%): At most values in .
- Subtask 3 (50%): At most values in .
Examples
Example 1
Input
-1 8 12 7
Output
15
Explanation
Reject -1, accept 8, reject 12, accept 7. Their sum is 15.
Example 2
Input
0 10
Output
10
Explanation
Both boundary scores 0 and 10 are accepted; their sum is 10.