#CCBCHMOT0000023. Tổng số dương đến số 0 (Sum Positive Values Until Zero)
Tổng số dương đến số 0 (Sum Positive Values Until Zero)
Sum Positive Values Until Zero
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read nonnegative integers until the first zero. Compute the sum of positive numbers before the zero; an immediate zero gives zero.
Input
Whitespace-separated nonnegative integers terminated by their first zero.
Output
Print the sum of the values before zero.
Subtasks
- Subtask 1 (20%): At most 5 values, each 1..10.
- Subtask 2 (30%): At most 200 values, each 1..10000.
- Subtask 3 (50%): At most 100000 values, each 1..1000000.
Examples
Example 1
Input
3 5 0
Output
8
Explanation
The two positive numbers add to 8; zero terminates input.
Example 2
Input
0
Output
0
Explanation
There are no values before the zero.