#CCBCHBON0000004. Tìm vị trí 0 đầu tiên (First Zero Position)
Tìm vị trí 0 đầu tiên (First Zero Position)
First Zero Position
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Find the first 1-based position whose value equals zero among integers. Print -1 if absent or . Here zero is a searchable data value, not an input terminator.
Input
First , then exactly integers , separated by whitespace.
Output
Print the position of the first zero, or -1.
Subtasks
-
Subtask 1 (20%): ; .
-
Subtask 2 (30%): ; .
-
Subtask 3 (50%): ; .
Examples
Example 1
Input:
5
2 0 0 4 0
Output:
2
Explanation:
Report the first zero, not later occurrences.
Example 2
Input:
0
Output:
-1
Explanation:
Report the first zero, not later occurrences.