#CCBCHBON0000047. Liệt kê bội qua sentinel (Print Multiples Before Sentinel)
Liệt kê bội qua sentinel (Print Multiples Before Sentinel)
Print Multiples Before Sentinel
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read integers until the first -1 sentinel. Among preceding values, print nonnegative multiples of 5 in input order, one per line. Zero qualifies. Other negative values are ignored but do not terminate processing. Empty qualifying output means zero output bytes.
Input
A whitespace-separated integer stream with no leading n. There are 0..10000 values before the first -1; each is in [-1000000,1000000] but not -1. The terminating value is -1.
Output
One qualifying value per line; output nothing if none.
Subtasks
-
Subtask 1 (20%): Up to 10 numbers before -1; each in [-1000000,1000000] excluding -1.
-
Subtask 2 (30%): Up to 250 numbers before -1; each in [-1000000,1000000] excluding -1.
-
Subtask 3 (50%): Up to 10000 numbers before -1; each in [-1000000,1000000] excluding -1.
Examples
Example 1
Input:
10 -5 0 12 25 -1
Output:
10
0
25
Explanation:
Print nonnegative multiples of five preceding -1, including zero. Exact input: "10 -5 0 12 25 -1\n"; exact output: "10\n0\n25\n".
Example 2
Input:
-1
Output:
Explanation:
Print nonnegative multiples of five preceding -1, including zero. Exact input: "-1\n"; exact output: "".
Example 3
Input:
-10 -2 -1
Output:
Explanation:
Print nonnegative multiples of five preceding -1, including zero. Exact input: "-10 -2 -1\n"; exact output: "".