#CCBCHMOT0000019. Đếm giá trị trước dấu -1 (Count Before Minus One)
Đếm giá trị trước dấu -1 (Count Before Minus One)
Count Before Minus One
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read integers until the first occurrence of exactly -1. Count all preceding integers. Other negative values and zero are ordinary data.
Input
A sequence of integers ending at its first -1.
Output
Print the number of integers before -1.
Subtasks
- Subtask 1 (20%): At most 5 values in [-10,10] excluding -1.
- Subtask 2 (30%): At most 200 values in [-10000,10000] excluding -1.
- Subtask 3 (50%): At most 100000 values in [-1000000,1000000] excluding -1.
Examples
Example 1
Input
5 0 7 -1
Output
3
Explanation
Five, zero and seven are three values; -1 does not count.
Example 2
Input
-2 -3 -1
Output
2
Explanation
Both -2 and -3 are data because only -1 terminates input.