CT24594

Tanya's Ancient Ledger

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The tallyman Tanya has been asked to price the new merchandise line. On the desk lies a long table of ingots readings. 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 <= 505; 0 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 381 21661712 531091746 738362369 998419540 895143634 547605683 678296755 740222309 813367683 683078945 865550464 688943428 254378904 370760334 694820392 292400131 786252142 492616800 733549711 730226187 859585093 754953085 577583053 120938472 584751899 705687770 340058628 632928679 341591946 672692268 734217853 619802542 265811315 138668813 185730749 271596038 483330673 795859636 112019367 544114016 315126154 750714722 744453499 849703888 346484073 660125482 712671728 29788094 612872394 372380625 994282777 187486195 209251454 42164857 358525204 509205775 551172438 999090369 382075538 985886486 145805029 97242622 979665256 449038459 716938569 214116273 825095103 799621966 700466220 706576591 809459941 669245234 574537875 552250548 983648222 750130288 249757464 739295474 93503584 6489942 303…
Output: 97638765294

Example 2:

Input: 65 150054904 298296598 682762911 561797398 251419474 578313464 67661366 230240876 164000273 953237909 472151014 803480753 548080571 861241089 80063599 301188380 452879209 61092585 285614517 310052859 813971752 286203374 387459226 846347435 496992579 399475745 932981629 947896384 124492523 456577457 139736877 592394589 503070279 943034249 184723202 782234306 753252928 148156150 437912378 203415072 258337635 898275490 284588000 986734121 237230425 600896911 275603803 43925328 849084930 234302429 222864614 891194464 614971751 846800124 911251996 221119187 983671089 857870044 280333499 740495029 318807573 239136819 153294549 104179848 393414442
Output: 14159797526

Example 3:

Input: 33 755070068 552047443 15445186 215378778 756875025 384048436 846394271 6171884 636058333 709382284 700307254 29003023 43089983 212030911 120816275 852923250 813162710 578729485 909991794 858879276 555421718 305860293 817613403 848548403 181524097 502845496 158070042 659942741 875527170 539364311 747470005 62731900 772243443
Output: 8375357246

Constraints:

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

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