CT24698

Ranger's Ledger of lanterns

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Legend says the vault under the shale slopes of Greystone opens only for a perfect tally of lanterns. Ranger means to find out. 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 <= 254; -1000000 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 132 -616380 -379055 -247507 -697576 -329840 -312417 -654829 -325224 -834858 -909630 -598946 -21202 -83100 -98127 -611413 -714978 -407857 -593124 -911059 -763751 -591766 -8438 -995943 -816060 -170567 -314017 -458142 -269800 -897798 -346962 -835514 -252309 -692157 -915278 -886524 -23569 -918769 -550975 -158692 -46565 -400792 -469403 -604802 -646879 -70399 -965683 -391489 -707165 -435049 -712764 -999075 -994595 -280429 -266608 -223614 -744195 -605230 -476558 -438742 -86234 -653552 -498129 -629809 -875122 -107626 -895728 -252299 -786126 -732991 -987089 -175691 -561674 -519281 -561017 -921838 -651289 -300829 -271526 -928467 -511600 -752631 -239969 -360214 -551809 -504917 -638974 -45708 -760986 -768647 -291800 -451658 -114866 -768533 -388255 -738917 -40821 -800000 -14810 -494402 -837703 -12704 -…
Output: -33862360

Example 2:

Input: 157 -261462 -12843 -772375 -351385 -425212 -288739 -51260 -834851 -197392 -604074 -641935 -534162 -234052 -910527 -651426 -902315 -307803 -644360 -946372 -316004 -318340 -865616 -505983 -225022 -949050 -766915 -862550 -31549 -336784 -815821 -474614 -719155 -46894 -628504 -746669 -439534 -75307 -580838 -843631 -396662 -745065 -927821 -388430 -29012 -870552 -227816 -767392 -946631 -538222 -376771 -113549 -476353 -91081 -746758 -483298 -396896 -839859 -794258 -154671 -497029 -417259 -103499 -760700 -355945 -79832 -497605 -919009 -563231 -47077 -196696 -122347 -907693 -638199 -789904 -974375 -832586 -936643 -643389 -404176 -150448 -24466 -931501 -648205 -687162 -532738 -525038 -371711 -839200 -989483 -630991 -271431 -861586 -356981 -255859 -636223 -296993 -636045 -552548 -590617 -614541 -24906…
Output: -38761430

Example 3:

Input: 239 -182508 -930320 -566135 -995802 -482050 -108817 -293438 -77303 -525334 -125413 -287724 -605560 -625099 -604746 -510402 -755227 -31619 -793411 -267372 -594571 -641884 -475058 -694351 -538873 -284368 -915853 -602952 -824417 -2924 -54064 -127169 -53084 -645308 -156941 -446185 -895323 -482973 -811736 -811365 -312340 -409837 -795085 -781721 -38300 -907583 -905159 -722215 -922060 -544930 -133869 -331213 -89527 -979654 -100989 -200505 -646771 -741707 -650181 -88984 -716805 -731087 -480681 -570238 -708702 -887046 -342711 -992985 -698537 -613662 -486321 -516222 -85300 -967145 -443679 -868700 -559774 -425111 -579808 -38298 -789893 -271983 -468011 -31618 -962178 -458424 -934700 -632668 -976811 -17234 -719863 -760137 -958508 -202004 -436460 -962284 -733782 -887738 -611557 -486879 -749592 -883412 -…
Output: -52952338

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Ranger's Ledger of lanterns - EASY Coding Problem | CodeTikki