CT24480

Lothar's lanterns Even Values Sum

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Deep in the zephyr cliffs of Galeholm, Lothar 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 <= 612; -100 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 63 336229647 343580877 540712124 677377460 72245696 511319486 918146833 749469006 671646776 206888658 424931484 337538538 496689570 191320596 123026629 289147431 339321160 76235304 900257111 839782243 830547457 390848172 892999372 829079718 235627709 914488845 499683858 440804273 486864503 236187618 372950534 940483938 756156810 656163025 760246093 605479981 674209105 719532735 821519868 76638543 580622013 540062152 455339807 728630515 180725142 711449907 630393613 817508512 206440625 28927372 689863025 60493734 844340562 9524880 948142779 182380983 976639037 168711386 901638093 929236901 340647571 943613359 813015871
Output: 13685899486

Example 2:

Input: 271 361413337 924670179 240445484 984154070 691269064 2907032 92680272 429342696 783458224 898532261 851771053 910030071 435312762 616605387 249801726 998615835 39691685 539243172 213327269 301645967 439966818 609021673 957863105 640653141 502681085 868766817 610674740 66186423 145074113 499050681 690966650 348817501 998879542 710439145 516078973 614129440 763889642 161569682 921444811 48436343 471638525 539327266 669009590 582816603 361492390 170504455 835007191 817065270 459308304 241553256 211006322 534308676 315581298 610765109 660422477 188333804 728814460 887338185 675225144 155478375 138946293 589787533 882548158 651208794 844722354 562208105 602690238 919967630 590208424 927931976 683348960 775472735 330148728 450570145 587861623 859915698 612848957 809565100 6730235 336861319 780054364 83047654 636043374 138775084 46124162 589841950 654081777 476506469 445240590 275891085 483138530 334909815 246354442 339318143 178296760 457478179 174296257 396006693 589644065 130411377 613828602 864514081 2007950 634338248 356049709 985805693 274169350 463939682 136168498 999895455 232663936 164841140 506141867 88275700 859952188 530648252 450089762 899160855 235038726 712178575 56126581 971602227 108365999 962392127 340221350 181224274 325203027 936997312 831885978 594142411 84851238 760426798 979475261 834085376 842343792 521827528 887012897 44252748 321427287 675107532 854543831 735129000 804659053 244194578 95211574 606947509 529659658 12432119 94448094 600696084 461306751 959246839 489544555 857764930 519604232 850088144 323991542 346483240 830864766 923042698 348468459 639620356 731641577 328157001 73313252 19881529 310877278 532457761 179743997 681224733 168645253 493224491 486856927 984145635 419452684 262776532 404056855 257060278 927364509 359545582 31152768 322931430 169590179 36855526 408552780 634613499 591058478 8225425 63984116 181327417 126675220 779626081 238154074 677246401 964010789 34571871 530723767 761081127 476773936 617408778 373088537 722929084 564448223 621185273 237068999 146116909 648717119 691440833 365250920 470188849 442453982 665817899 976025641 556298225 388992137 543650927 790547859 384135702 220685679 678152338 614222574 722953633 832270022 163620653 799639045 225771528 276827377 898551709 393803323 440904067 216550369 850816084 629149236 127349301 798204464 423414465 490703153 870084640 227303303 255907592 821237851 362776796 860336410 499416562 3686627 979809980 797423569 563535288 189361585 300696138 129866397 560573443 21651637 961720217 924739278 379876374 423517266 540020091 822557638 491843730 398980728 557390961 887869688 734450725 428657286 843250101 728827808 114802900 438337391 216744551 977382755
Output: 65963039370

Example 3:

Input: 126 721908929 282882407 820703303 410625823 315349152 582743534 712962249 427431304 8988136 891743877 438318576 707592730 949825790 951950973 674018630 503765767 589175839 354147127 961015369 458455934 516281111 561828803 943579420 434332782 762945740 51003262 192527025 991929987 561082185 642890886 58832019 174312826 256512972 731684267 171519695 95197660 609961398 294805012 325677401 300222483 278258589 144835298 914762768 266225972 311957463 862780910 583257504 251061055 873893119 502830688 227949293 285478488 568831227 765097891 193565661 405389764 722694927 436699266 637096950 392746913 561330040 893419382 496365777 40846567 27761700 388733805 632489254 629433668 985030494 911326253 869367936 81806374 390508073 444922883 435994121 828362546 542931627 863883933 921420961 727707532 398350934 472746028 553297081 254538103 239433289 650746709 79023097 760408926 974034836 827804019 115775956 704086687 956486084 548527016 622831165 376618398 82479316 555850394 188154282 23984422 346048528 90456067 457519737 542658202 122763561 604972740 29847985 39346373 17663666 884133767 726616182 477809144 148501143 770000763 646323820 867122589 54448291 977089422 375745359 256318533 988341595 522911414 114872019 53553477 528833670 815680865
Output: 30948675658

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Lothar's lanterns Even Values Sum - EASY Coding Problem | CodeTikki