CT598

Mira and the Whispering lanterns

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Mira found an old ledger of lanterns in the ropewalk attic at the quays of Driftwood. The margin notes pose a precise question. 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 <= 51; 0 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 24 971 449 974 574 942 289 183 489 796 681 301 293 541 934 459 472 799 290 306 827 366 733 524 936
Output: 7114

Example 2:

Input: 42 558 353 318 154 24 770 537 17 830 282 829 311 751 475 707 698 423 888 95 589 763 884 4 745 84 667 456 348 296 981 61 442 350 848 946 625 446 625 779 310 307 757
Output: 9936

Example 3:

Input: 30 195 656 438 925 941 89 228 294 848 528 782 524 258 322 595 633 176 23 40 409 793 685 682 389 240 218 596 527 647 578
Output: 7408

Constraints:

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

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