CT22625

The Even Minus Odd at Bramblecourt

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Yami inherited the kiln at the thorn maze of Bramblecourt along with its curious bookkeeping system for barrels. Time to make sense of it. Task: Read n integers and print the sum of values at even 1-based positions minus the sum at odd positions. Input format: First line: n. Second line: n space-separated integers. Output format: Print (sum of even-positioned) - (sum of odd-positioned). Constraints: 1 <= n <= 413; -1000000 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 233 -306892 -319804 -656761 -503390 -377691 -264859 -682804 -335519 -889971 -40333 -880233 -559672 -740237 -611154 -106713 -19629 -470555 -644802 -673444 -256845 -468981 -591800 -529485 -418137 -327971 -165370 -693429 -608197 -885046 -434819 -747408 -632658 -150806 -354684 -318915 -446416 -900177 -16701 -965626 -920858 -329473 -910414 -254337 -879804 -335488 -558721 -515946 -92287 -187609 -984926 -77025 -15470 -359381 -358691 -991079 -794617 -990737 -245706 -77691 -297785 -880504 -242476 -20967 -897797 -208994 -826479 -582726 -964534 -748686 -907807 -700278 -438511 -782559 -220735 -11888 -345329 -210343 -812590 -954018 -286841 -911642 -685944 -795895 -810545 -919628 -881826 -526598 -747423 -496016 -437011 -635137 -439933 -208428 -477717 -592776 -957422 -81383 -563676 -592269 -610679 -54164…
Output: -2763104

Example 2:

Input: 354 -648751 -673801 -894325 -387218 -21238 -837392 -822652 -196483 -251294 -144126 -736233 -895884 -59298 -473415 -724749 -258164 -624332 -392320 -629300 -91091 -208215 -140638 -359731 -241243 -771371 -285562 -978187 -683522 -652633 -884199 -209991 -647881 -566583 -827478 -692093 -313890 -477814 -493984 -490806 -297252 -241024 -454888 -21434 -376923 -781238 -991505 -902229 -630500 -181136 -310553 -296317 -771744 -943668 -774925 -320643 -215853 -115755 -781932 -17183 -548755 -888885 -649212 -692975 -98044 -996886 -717904 -474676 -682984 -592868 -589197 -560727 -879404 -245013 -45759 -534130 -435556 -957254 -85981 -386115 -556633 -77230 -312188 -520573 -322596 -448899 -850950 -71040 -909071 -785304 -374522 -138812 -95186 -865537 -949214 -328386 -167266 -767061 -441252 -217254 -770649 -250643…
Output: 6360527

Example 3:

Input: 279 -966344 -280784 -820670 -144470 -727665 -866458 -805706 -562233 -176886 -539869 -904875 -988349 -117844 -920873 -417940 -670810 -84828 -815934 -311045 -946565 -931494 -994594 -975344 -411358 -353701 -985795 -844942 -569798 -205577 -902607 -776696 -83859 -841108 -721121 -70510 -3469 -815216 -395462 -982068 -932813 -877028 -909699 -944054 -241053 -603535 -625247 -639569 -49904 -722134 -505142 -318897 -305021 -198147 -206879 -538875 -69950 -354654 -752549 -856229 -245190 -574532 -442669 -353024 -383535 -538443 -275257 -558944 -437887 -564194 -590955 -683907 -240478 -17709 -614147 -182858 -58094 -163530 -518254 -571813 -330987 -4000 -183842 -795492 -994975 -388072 -972074 -153045 -41952 -22729 -619314 -595590 -405905 -51712 -721713 -610802 -72809 -277954 -320016 -308535 -188890 -148961 -94…
Output: 1147102

Constraints:

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

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