CT2274

Jaya Counts the tickets

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

At the honeycomb cliffs of Beeswick, Jaya records each tickets in a worn leather ledger. The guild wants answers, not guesses. 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 <= 86; 0 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 15 104652243 451389002 839630457 835048822 392513725 21438892 182762943 937917847 504143573 678513044 391002431 826176855 973974531 157276949 50032027
Output: -469049481

Example 2:

Input: 61 856129905 360305943 796519200 281218859 297883450 598118589 895129359 819244463 201757022 341969294 484554905 131657251 286350920 886536599 834348343 221567678 219662156 144838527 258434218 615508029 321934134 168130310 441288930 985874015 280606132 816727217 158979014 588097922 472475455 581809376 395081950 48242663 147290284 670679395 335539880 309684675 361964667 160137751 665000673 518032453 783892819 873491640 40370391 817229666 150028230 893120126 74508475 478717014 921799571 755893325 498484241 494923020 475586892 603999946 47209406 322736155 836614840 211087934 189368655 684097500 938471850
Output: -1716411368

Example 3:

Input: 68 212486420 455656415 797617644 132462011 468174170 207390437 387343402 957890933 676375257 693541073 952575653 376599272 922393816 180710687 708191187 673246433 56969258 692711830 403409339 258061707 709942410 273106100 59985526 537941438 215166261 39035760 588522698 632610902 758325257 561313757 911079972 552812040 622041648 346305613 170125041 855183815 151823251 760675392 453817835 427583755 751626266 715994972 311804808 288574725 287946464 175940637 239260596 261478538 776930899 95190895 867063000 390475615 320524783 607356824 379353757 507324252 801664487 603798656 343759878 42849862 843482239 146172211 557089330 714566447 628843461 201329982 175227123 417317768
Output: 2727732382

Constraints:

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

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