CT772

The lanterns at Thornveld

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Deep in the acacia flats of Thornveld, Rekha studies rows of lanterns entries. One clean number will settle the guild's oldest argument. 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 <= 69; -1000000 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 53 -997623 -747363 -550059 -725034 -755987 -719234 -464521 -484837 -14953 -783969 -202052 -80135 -445427 -468597 -199366 -571337 -103486 -361862 -506325 -225538 -336102 -769836 -718237 -212236 -469477 -594050 -248361 -661965 -615626 -785663 -792895 -277187 -294181 -706348 -484318 -284074 -444001 -892128 -330585 -945852 -383704 -428112 -625689 -977883 -410691 -850471 -803872 -251814 -144396 -551419 -356677 -177535 -632898
Output: -11021938

Example 2:

Input: 26 -165893 -749118 -996171 -642090 -412282 -871954 -518074 -403968 -297627 -160654 -88204 -32144 -686917 -4486 -975806 -899720 -852220 -773693 -648641 -481530 -986476 -97277 -591115 -682762 -807270 -630058
Output: -10198816

Example 3:

Input: 60 -626880 -335220 -805931 -781952 -999673 -377202 -267225 -131439 -184671 -994329 -222736 -28874 -241485 -265518 -624821 -487046 -488095 -841298 -76838 -534185 -889223 -504051 -954581 -112447 -238321 -863881 -455437 -304646 -18639 -901986 -986006 -301367 -76406 -83724 -666243 -474788 -796283 -921114 -405442 -596067 -322184 -414200 -431146 -367663 -797988 -273627 -670943 -305088 -812630 -547900 -426331 -575502 -336766 -699710 -9202 -463755 -420026 -556505 -973212 -401960
Output: -15245190

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The lanterns at Thornveld - EASY Coding Problem | CodeTikki