CT26132

Lazy stamps Even Minus Odd

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Every season at the crystal caves of Luminar, someone must certify the cargo before shipping. This year the task falls to Captain, armed only with the stamps register. 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 <= 271; 0 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 75 899361623 896537018 373235706 859151762 508790493 23126836 834545147 161686763 863201671 78982873 80931274 466972918 632141445 193737266 225868791 25057182 707167528 958769057 111358617 280153421 361713941 686929060 26752404 764392152 612772956 786023032 586283637 728825687 923811948 115517344 904218590 196568269 249032099 770503056 707178283 351068319 65109786 800375387 666543340 461374373 728671488 686174934 659175171 909220464 583702349 783178038 922695375 814044524 444657914 698782221 859936686 558814362 535451206 740958494 33092114 121230675 264304607 486683896 652382469 511415653 854152950 861745147 36229048 862132463 119169844 663382332 945359832 928113084 491164823 574393184 464489189 893620222 853051157 659361672 125607180
Output: -1445690459

Example 2:

Input: 176 370120184 644350338 436816820 115274627 88797926 360658790 264456146 257232852 817632670 889363566 207494449 98981104 711907801 422342096 414659741 445738055 247516064 170751012 229048267 175426648 450738746 895396100 153821148 466114479 208228259 104405576 942732664 591264153 110432139 438162942 73205670 858333645 993810452 564428687 626576430 164312549 568311254 690543444 110945033 701237565 925995648 627455704 211962354 814711437 295068069 416796849 732420055 729851622 328132158 130054229 840963068 51223024 585063894 911302456 447096958 934574874 263608010 914529200 437412488 450282629 188715546 62886457 248306733 747789873 326363885 232229293 921685016 17682808 922678308 282580902 73889298 763619771 569695460 976367142 401664913 575861974 377061778 262630749 108445952 461928862 383…
Output: -6968822149

Example 3:

Input: 76 974483523 351793205 792432976 521208472 205119482 921159228 124761599 816119616 887226275 963435821 294059211 207182828 107186674 307844731 621667697 736954357 117211838 133057917 422906129 726059554 306438387 138971697 535871841 692782699 416400986 991742559 836181658 844379934 960629097 215642902 348180151 918514241 472258651 907436071 391925817 784984094 991733991 568469271 52849109 694563610 105059547 946220702 414161834 147165881 537074832 205451516 579425101 696066602 633159477 527033343 537983653 729622645 819273834 220805742 383698976 621849993 624293021 735022807 752883917 373028718 339004899 347532882 931808874 375430614 694043159 362369715 216549638 881196244 469297207 9140989 380535819 880267697 524349842 959032496 161890798 125039403
Output: -2620561276

Constraints:

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

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