#CCBCHBON0000022. Dừng khi đọc END dạng số (Stop at Numeric Code 99)
Dừng khi đọc END dạng số (Stop at Numeric Code 99)
Stop at Numeric Code 99
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read integer codes from 0 to 100 until the first code 99. The sentinel is not counted. Count preceding codes from 1 to 5 inclusive; any other code except 99 is ignored without terminating. Print 0 if the first code is 99.
Input
A whitespace-separated sequence of 1 to 100001 integer codes. The final code is the first 99; there is no leading .
Output
Print the number of codes in before the first 99.
Subtasks
-
Subtask 1 (20%): At most 8 codes before 99, each in .
-
Subtask 2 (30%): At most 1000 codes before 99, each in .
-
Subtask 3 (50%): At most 100000 codes before 99, each in .
Examples
Example 1
Input:
1 5 0 100 3 99
Output:
3
Explanation:
Valid preceding codes: [1, 5, 3]. Count: 3; sentinel 99 is excluded.
Example 2
Input:
99
Output:
0
Explanation:
Valid preceding codes: []. Count: 0; sentinel 99 is excluded.