PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CCBCHHAI0000010. Đếm lần nhập sai trước khi đạt chuẩn (Count Invalid Scores Before Acceptance)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm lần nhập sai trước khi đạt chuẩn (Count Invalid Scores Before Acceptance)
Count Invalid Scores Before Acceptance
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read real-valued scores until the first value within the inclusive interval [0,10]. Count only preceding invalid scores; do not count the successful read.
Input
A sequence of scores, each written with at most two decimal places. The last score is in [0,10] and all prior scores are outside it.
Output
Print the number of invalid scores before the first accepted score.
Subtasks
- Subtask 1 (20%): At most 5 scores, each within .
- Subtask 2 (30%): At most 100 scores, each within .
- Subtask 3 (50%): At most scores, each within .
Examples
Example 1
Input
-1 10.01 10
Output
2
Explanation
-1 and 10.01 are invalid. The last value 10 is accepted, so the answer is 2.
Example 2
Input
0
Output
0
Explanation
Zero is valid on the first read; the count is zero.