CT27226

Ulrica's Zigzag Ledger

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Ulrica runs the shed at the mulberry rows of Silkmead. Today the books show a list of readings, and the numbers must be worked out before sundown. 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 <= 960; -100 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 395 -5 -65 -68 -30 -85 -31 -59 -54 -24 -66 3 -61 -88 -50 -67 -63 -72 -62 -61 -44 -82 -94 -68 -68 -80 -57 -91 -41 -24 -8 -96 -16 -14 1 -94 -13 -84 -22 -7 -90 -72 9 -75 -28 -83 -16 -6 -6 -32 -85 -59 -61 -35 -82 -45 -11 -25 10 -31 7 -39 -100 0 -71 -4 -60 -48 -82 -78 -99 -50 -95 -83 -20 -87 -48 -35 -22 -40 -21 -45 -43 -22 -26 -36 -52 -23 -54 -23 -43 -93 8 -39 -48 -32 -4 -35 -32 -65 1 -95 -71 -94 -21 -31 -51 7 -42 -65 -100 -70 -85 -36 -66 -80 -29 -94 -16 7 -17 -59 -63 -31 -98 -61 -29 -15 -27 -28 -100 3 -76 -93 -79 -49 -40 -84 -90 -51 2 -12 -68 -33 -18 -11 -42 -98 6 -2 -49 -98 -59 -34 -22 -54 -40 -80 10 -50 -2 -2 -90 -38 -35 -96 -18 1 -11 -82 -96 -82 -88 -69 -10 -46 -16 -22 -81 -15 4 -27 -46 -52 4 3 -94 -99 -99 -88 -98 -28 -53 -29 -1 -10 -20 -53 -65 -20 -66 -93 -14 -38 -45 -23 -1 -1 -9 -74 -50 -…
Output: -10226

Example 2:

Input: 396 -17 -51 -48 -87 -22 -83 -87 -42 -12 -29 -20 -75 -56 -24 -53 0 -3 -85 -23 -32 -29 -20 -45 -69 -72 -2 -30 -51 -92 -22 -67 -15 -36 -39 3 -35 -72 -36 -83 -34 -71 2 -67 -49 -31 -13 -44 -51 -99 -67 7 -65 -59 7 -79 -87 -35 -84 -33 -78 -36 -19 7 -8 -78 -19 -54 -11 -68 -96 10 -81 -27 -4 -19 -4 -70 -35 -99 -27 -16 -6 -1 -71 -56 6 -70 -87 -5 -39 -45 -11 -11 -11 -88 -19 -21 -33 -57 -26 -33 -60 -20 -93 -29 -43 -69 -65 -81 -3 -99 -31 -86 -11 -57 -25 -1 8 -55 -17 -41 10 9 -77 -84 -7 -67 -57 -50 -31 -6 -57 -47 -70 -98 -23 -81 3 -94 -11 -10 -50 7 -36 -10 9 -27 -1 -74 -72 3 -1 -27 -34 4 -50 -62 -92 -51 -87 -88 -7 -92 -45 -24 -57 -20 -23 -25 -68 -63 -3 -41 -24 -33 -49 -24 -17 -2 -7 -35 -33 -39 -51 -96 4 -57 -1 -67 -36 -55 -91 -13 -16 -7 -94 -46 -33 -94 -6 -43 -26 10 -60 -10 0 -99 -80 -6 -29 -69 -94 -3 -6…
Output: -8320

Example 3:

Input: 176 -93 9 -36 -24 -62 -100 -53 -100 -55 -43 -68 1 -59 -27 -79 -92 -17 -29 -12 8 8 8 -53 -63 -72 -87 -43 -50 -26 -43 -25 -55 -88 -2 -16 -64 -33 -1 -78 -38 -83 8 -59 -66 -27 -100 -51 -62 -88 -51 -59 -35 -52 -9 -77 7 -94 -47 -60 -12 -33 -41 -37 -27 -15 -54 -63 -52 10 -99 -13 -29 -6 -43 -92 -47 -12 -33 -9 -72 -93 -31 -19 -91 -25 -60 -96 -47 -2 -48 -42 -20 -20 -73 -59 -50 -26 -15 -46 -11 -9 -48 -71 -86 -7 -78 -79 5 -5 -23 -61 -36 -80 -28 -95 -85 8 -24 -6 -63 -51 -5 -16 -46 -46 -76 -96 -45 -43 -26 -68 -6 -9 -39 -40 4 -19 -29 -77 -63 0 -60 -14 -38 -27 -71 9 -96 -68 -93 -32 2 -94 -4 -38 -14 10 -5 -7 -95 -44 -45 -37 5 -3 -46 -21 -12 -39 -22 -43 -65 -45 1 -86 -80
Output: -3648

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Ulrica's Zigzag Ledger - EASY Coding Problem | CodeTikki