#CCBCHHAI0000036. Đếm lần sai trước khóa mã (Wrong Attempts Before Code Lock)
Đếm lần sai trước khóa mã (Wrong Attempts Before Code Lock)
Wrong Attempts Before Code Lock
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
A system reads a sequence of integer codes. The correct code is 123. Each value other than 123 is a wrong attempt. Stop immediately at the first 123 and do not count it as a wrong attempt. The input guarantees that the first 123 exists and is the last value.
Input
A whitespace-separated sequence of at most integers. The final value is 123; no preceding value equals 123.
Output
Print one integer: the number of wrong codes before the first 123.
Subtasks
- Subtask 1 (20%): At most 5 values, each in [-10,123].
- Subtask 2 (30%): At most 100 values, each in [-1000,1000].
- Subtask 3 (50%): At most values, each in .
Examples
Example 1
Input
12 123
Output
1
Explanation
12 is one wrong attempt; 123 stops without incrementing the count.
Example 2
Input
123
Output
0
Explanation
The first value is correct; there are zero wrong attempts.