CT24672

The Even Minus Odd Beneath Cinderline

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Legend says the vault under the railway depot of Cinderline opens only for a perfect tally of stamps. Cleo means to find out. 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 <= 730; 0 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 262 619110490 662632848 563722705 57695551 275744435 328935337 84115143 595278216 849503191 211022889 374198618 429036203 220923259 714506793 918585117 707024710 387192311 907351714 920649292 373431067 729103278 311774261 699351254 287103928 314304059 638736221 763435113 15669284 362717933 339710345 591584707 276751097 102209934 720465484 622964380 464419310 533797415 859365138 722203230 726858813 223601361 940131290 40220038 135726660 589078960 900766532 798581768 155151327 628208530 987494826 768747955 248555210 652497963 879181409 8273034 794312171 260333068 804069337 583764560 487757981 301697336 367775199 983663932 270080650 494663926 444691991 348805459 6712723 795855697 9030617 287151682 770291972 805814959 641532743 642680765 514394448 115746439 317360092 486638276 296391473 915167…
Output: 5821011455

Example 2:

Input: 544 1120 822425798 109709773 500955647 599159015 241769498 857240154 295741380 924866246 908649053 899016253 914760145 790196969 158408074 998672575 686773702 845319539 472632285 564817583 7440752 906226622 380610528 528729555 587323762 390726015 789250062 605664833 43275666 960634099 677096659 427896302 362463634 481685332 766229767 615013988 804334977 3249742 862917071 55061621 628709296 771043479 322490720 211054627 670269724 200861700 172861907 731933578 984448437 749062822 799680835 65227127 998270355 709370248 621902957 881359160 492554000 51042232 687880211 349401071 732093536 106457424 686269373 357432656 980144547 854370783 148089276 460087965 519519453 829316453 893965844 517809376 53443949 197011021 387731354 574790172 137645074 640961967 937957338 9875031 795344462 952012597 65…
Output: -4183302519

Example 3:

Input: 642 122461992 241711189 803724342 524537631 855718063 571762646 837761752 657352763 322493583 653357692 958632212 529202869 77359730 85862438 952664669 929229070 915083223 377823213 486592516 333086530 910634451 510676377 752031084 246675661 31052702 996500622 700722439 922143574 311262940 573396929 445819683 820699073 406144168 814570215 858434335 811594022 759306926 353661083 146392733 358172368 927744070 994516395 349771718 863206381 710824115 980225381 936301158 425755103 946165480 81908965 349689187 555270313 495370737 273203031 392956271 928206456 207797432 213257697 233622966 377791340 805516702 903750841 453114628 475903257 543603366 831433710 208404868 927797063 556984027 745795698 636059290 144084176 421710711 399994114 425823349 870490499 218925591 223562947 579192233 381586658 …
Output: 10798561868

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Even Minus Odd Beneath Cinderline - EASY Coding Problem | CodeTikki