#CCBCHHAI0000028. Nhập các số nguyên dương theo phiên (Count Positive Values by Session)
Nhập các số nguyên dương theo phiên (Count Positive Values by Session)
Count Positive Values by Session
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
There are consecutive sessions. In each session, read integers until encountering zero; zero ends the session and is not counted. For each session, count the strictly positive values before zero; negative values are ignored. An empty session consists of zero alone.
Input
The first line contains (). Exactly sessions follow; each consists of integers ending with zero. All sessions have a terminator and no values follow the last session.
Output
Print exactly lines. Line gives the number of positive integers in session . If , produce empty output.
Subtasks
- Subtask 1 (20%): ; at most integers per session including zero; values in .
- Subtask 2 (30%): ; at most integers per session including zero; values in .
- Subtask 3 (50%): ; at most integers per session including zero; values in .
Examples
Example 1
Input
3
1 -1 2 0
0
-2 3 0
Output
2
0
1
Explanation
Session 1 has two positives (1 and 2). Session 2 is empty. Session 3 has one positive (3).
Example 2
Input
0
Output
Explanation
There are no sessions; the program prints nothing.