CT23387

Seth's stamps Reckoning

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Legend says the vault under the northern keep of Frostgate opens only for a perfect tally of stamps. Seth 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 <= 749; 0 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 52 435941837 230219406 192975344 365196354 415827490 300428969 931794230 66671958 255931858 186852704 342046897 386836657 110359939 917286147 179176428 241998552 725284300 992526712 997578061 934694052 342293752 848947283 903434064 473858655 291869956 639022559 959855474 926147912 422240958 58075070 397337576 83502072 261668287 909851701 435255379 698092186 553328675 747355263 64828253 778736385 374222052 375457902 877142567 780086353 991561825 410157794 714484048 528512322 464917609 351239547 742125638 157335606
Output: -5607624

Example 2:

Input: 168 105287710 100732304 622155001 129034105 625908149 696161590 56371220 241367396 345061761 764807854 924736406 249402190 733839594 454670957 13322949 312259154 657658903 151694310 800369002 412035876 170545314 964067025 186509744 356304102 94153142 287283962 777190052 464029437 975935723 637675527 911262947 814030770 326725038 80318089 352088135 226217739 616327482 266871379 294312830 253633579 595745586 849694391 917803189 194288560 565411943 889876833 855189048 787203786 644120811 929282808 958836745 68660990 812943720 240182148 219975407 447913983 700672062 986507817 210409105 799785680 220605048 724440607 542450653 226885538 353936401 631946584 18892736 420457956 87041111 819717082 104921742 338392605 778928345 730434769 231283323 647797556 350253862 638342089 989043578 712213330 414729455 495164772 956344565 426637024 981286011 659424260 689626593 350426856 781903064 102451655 279877945 765317877 573303006 703076706 214528765 289893178 201073223 740279166 172405776 66352860 268790866 626102120 643539213 780902910 580877944 712872975 988350596 704126388 892966224 672849088 77900752 50955659 926415980 236890607 816060400 518765397 655349397 520082696 990982839 673935860 874962464 362581321 122127914 798607546 822628721 474040278 316139482 101657040 537471432 483710432 909340031 27016790 648005516 586354854 805712058 974817323 256970507 129939821 583350243 663084640 96114479 632594895 556546165 845223628 728396117 852789746 326191057 716030805 693059022 771715604 617728649 52391399 174422749 497395913 14232635 599711011 506542714 514886822 251950257 5951585 274653124 723762996 348237232 761299007 242461468 711452472 811734270 607826181
Output: 435543817

Example 3:

Input: 43 932868591 340389959 389472319 112500533 338379334 853622801 202612398 997234560 176053845 529754944 270189967 930067970 999601038 754064214 681598616 836798347 103290609 890773940 746800834 457637960 734777058 645551892 980336898 793754844 583112723 979472446 884553565 476373187 497059549 372036102 325655156 739629931 642291551 193488435 271385163 398791640 961241101 221658923 750165352 926526863 135788810 253345951 541312460
Output: -554928505

Constraints:

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

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