#CCBCHBON0000020. Bỏ giá trị không hợp lệ khi tính tổng (Skip Invalid Scores)
Bỏ giá trị không hợp lệ khi tính tổng (Skip Invalid Scores)
Skip Invalid Scores
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Sum only scores within the inclusive interval among integers. Ignore values below 0 or above 10. Both endpoints are valid; print 0 if no value qualifies.
Input
Read (), then exactly integer scores in .
Output
Print the sum of valid scores.
Subtasks
-
Subtask 1 (20%): ; .
-
Subtask 2 (30%): ; .
-
Subtask 3 (50%): ; .
Examples
Example 1
Input:
5
-2 0 10 11 3
Output:
13
Explanation:
Only values in [0,10] are valid: [0, 10, 3]. Their sum is 13.
Example 2
Input:
3
-1 11 100
Output:
0
Explanation:
Only values in [0,10] are valid: []. Their sum is 0.