CT26167

The Even Values Sum of the Wild tickets

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Legend says the vault under the mining town of Ironvein opens only for a perfect tally of tickets. Darian means to find out. Task: Read n integers and print the sum of all even values. Input format: First line: n. Second line: n space-separated integers. Output format: Print the sum of even values (0 if none). Constraints: 1 <= n <= 820; -100 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 200 10 -70 -78 -37 -71 -57 3 -40 0 -57 -26 -21 -30 -10 -90 -67 -68 -53 -29 8 -85 -3 -6 -12 -89 -27 -15 -38 -82 7 -18 -66 -20 -40 -8 0 -54 -51 -6 -50 -96 -32 -100 9 -9 -53 10 -93 3 10 -76 -8 7 -44 -24 -71 -30 -51 -49 -79 -10 -19 -27 -71 -20 -33 -68 -97 -35 -70 -37 -83 -31 -50 -84 -39 -87 -31 -28 -58 -19 -41 -40 -96 -67 -53 -25 0 -36 -21 -13 -99 -26 -86 -9 -69 -44 -34 -57 -86 -55 -56 0 -49 -8 6 -72 -8 -19 -89 -2 -42 -54 -4 -61 -49 -42 -6 -77 -43 -11 -58 -40 -7 -85 2 -19 -30 -30 -42 -49 -62 -69 -96 -11 -82 -57 -39 -38 -26 -17 -13 -49 6 -28 -32 -88 -54 -98 8 -76 8 -87 -73 -23 -26 -93 -51 -100 -51 -85 -20 -41 -18 -93 9 -1 -83 -69 -20 -38 -91 -97 -75 4 -53 -31 -33 -57 -28 -11 -10 -49 -94 -75 -90 -64 -85 -81 -14 0 -75 -19 -70 -92 -26 -27 -95 -11 -12
Output: -3882

Example 2:

Input: 31 -79 5 -34 -10 -70 -89 -47 -27 9 -55 10 -65 -68 7 -95 -22 -90 -45 -18 -81 -40 -79 -11 -27 5 -30 -89 -13 -100 10 -2
Output: -464

Example 3:

Input: 254 -99 -2 -15 -28 -60 -30 -17 -51 -39 -55 -34 -45 -63 -85 -11 -89 -9 -18 -84 5 -81 -11 -74 -15 -76 -44 -31 5 -34 -64 -44 -99 -57 2 0 -64 5 -52 -54 -5 -53 -97 -21 -28 -35 -42 -41 -51 -81 -93 1 -53 -60 -20 -68 -78 -28 -89 -99 -59 -66 -14 -94 -80 -17 10 -36 -57 -28 -82 6 -96 -1 -40 -27 8 -24 -38 -97 -50 -4 -53 -79 5 -83 -13 8 -7 -99 -81 9 -46 -88 -97 -25 -99 -47 -2 -61 2 -78 -10 6 -79 -87 -96 -44 8 -39 -91 -92 8 -30 -42 -99 -83 -54 -27 -6 -60 -17 -31 -42 -76 -36 -34 -28 -46 -21 -13 -99 -74 -72 -27 -37 -58 -37 -74 -91 -95 -33 -48 -45 -50 -100 -54 -99 -24 -14 7 -81 -55 -73 -1 -56 -96 -40 -88 -82 -54 -42 -11 -1 -100 -1 -21 -93 -35 -50 -11 -53 -88 -51 -15 -3 -27 -83 -3 2 -56 -95 -93 -12 -52 -8 -8 -1 -89 -15 -56 -51 -25 -20 -93 8 -70 -2 -56 -6 -53 -80 -81 -96 2 -100 -96 2 -96 -72 -47 10 -84 -65 3 -79 -35 3 -88 -90 -99 -97 -44 -55 -55 8 -66 -10 -38 -47 -42 -67 -32 -43 -45 -44 -22 -18 -23 3 -57 -44 -4 -77 -72 -15 -51 -16 -79 -83 -76 -28 -18 -9 -47
Output: -5544

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.