#CCBCHHAI0000022. Hai điểm hợp lệ liên tiếp (First Two Valid Scores)
Hai điểm hợp lệ liên tiếp (First Two Valid Scores)
First Two Valid Scores
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
A device sends integer scores in order. A score is valid if it belongs to the closed interval ; every other value is ignored. Take the first two valid scores (they need not be adjacent in the input), compute their arithmetic mean, and stop immediately after the second valid score. For instance, in , choose and .
Input
A whitespace-separated sequence of integers containing at least two valid scores. The last integer is exactly the second valid score; no further input follows.
Output
Print the arithmetic mean of the first two valid scores using exactly two digits after the decimal point.
Subtasks
- Subtask 1 (20%): At most values, each in .
- Subtask 2 (30%): At most values, each in .
- Subtask 3 (50%): At most values, each in .
Examples
Example 1
Input
7 -1 12 9
Output
8.00
Explanation
7 is accepted; -1 and 12 are rejected. 9 is the second accepted score. The mean is (7+9)/2 = 8.00.
Example 2
Input
0 10
Output
5.00
Explanation
Both endpoints 0 and 10 are accepted; the arithmetic mean is 5.00.