CT26490

Last scrolls of Ivo

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Caravans arrive at the mushroom groves of Fungaldeep with crates of scrolls, and Ivo the cartographer must account for every last one. Task: Read n integers and print how many are strictly positive. Input format: First line: n. Second line: n space-separated integers. Output format: Print the count of positive values. Constraints: 1 <= n <= 255; 0 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 212 10 6 9 9 7 3 9 7 3 2 3 3 3 7 9 1 2 1 4 6 2 4 1 10 8 7 1 5 5 3 7 7 2 10 8 6 8 3 0 2 1 7 0 2 3 0 6 10 7 2 10 7 4 7 3 5 9 4 5 2 8 4 7 9 9 0 6 8 6 10 4 5 2 9 2 8 4 5 3 0 3 0 10 2 3 1 5 7 8 4 5 0 7 2 0 9 9 9 2 5 8 3 5 5 4 8 1 7 6 7 4 10 10 7 9 3 3 1 1 4 5 9 6 8 7 3 8 5 7 9 8 3 4 5 4 2 0 3 7 9 4 3 6 2 1 4 10 1 2 7 7 3 4 7 7 8 8 8 2 2 10 3 3 1 4 7 2 10 0 7 4 3 4 0 3 1 0 8 6 1 4 5 6 2 5 2 8 1 0 1 0 1 4 1 10 3 0 6 6 5 9 7 5 9 7 3 9 2 6 5 8 6
Output: 197

Example 2:

Input: 142 3 7 5 0 1 10 9 4 1 3 6 4 10 9 9 8 3 9 8 3 6 3 10 6 5 2 0 9 5 5 10 2 7 0 6 1 5 0 2 3 5 5 0 3 2 9 10 8 1 3 3 0 7 0 9 6 5 0 4 6 10 0 5 6 10 2 3 8 4 0 1 5 0 3 1 1 3 10 2 9 8 3 3 0 6 9 2 1 3 7 7 0 10 1 6 6 6 4 7 0 0 6 0 9 2 1 9 8 8 9 8 2 4 3 0 6 2 10 3 8 5 8 8 8 10 2 10 4 3 1 9 1 5 4 1 6 7 10 0 1 2 5
Output: 124

Example 3:

Input: 103 1 2 2 0 3 7 10 1 5 2 2 7 2 7 9 5 4 7 3 5 8 3 7 5 6 10 1 5 5 3 6 9 6 0 4 9 0 8 10 10 10 0 6 5 6 1 10 6 1 5 0 7 7 2 6 4 7 3 9 7 10 7 7 8 6 10 4 2 9 10 1 2 7 4 8 2 1 0 2 5 2 2 8 10 8 10 3 4 6 10 4 0 2 2 0 10 2 8 3 1 6 0 8
Output: 94

Constraints:

1 <= n <= 255; 0 <= a[i] <= 10; answers fit a signed 64-bit integer.

Loading...
Test Cases:No test cases
No test cases available.
Last scrolls of Ivo - EASY Coding Problem | CodeTikki