CT26846

Zia's Whispering scrolls

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Morning light hits the railway depot of Cinderline as Zia unrolls the day's manifest of scrolls. The tally will decide the next shipment. 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 <= 443; 0 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 296 600 107 445 826 371 514 665 660 704 371 644 7 515 300 860 726 187 762 56 793 713 137 754 729 313 202 823 87 603 79 567 83 680 59 493 75 961 148 901 188 298 582 176 491 97 424 529 573 271 171 567 936 556 165 250 251 804 333 435 698 816 139 319 213 745 829 872 718 829 304 141 588 457 207 89 432 335 227 867 659 958 359 164 289 558 883 971 679 465 35 485 255 487 759 283 274 346 459 602 682 85 866 620 922 535 317 650 791 319 319 159 305 521 245 531 213 668 535 109 821 761 4 250 64 541 668 766 467 65 154 419 479 831 122 739 316 242 222 445 530 749 184 180 220 249 651 21 562 803 376 550 887 897 129 23 943 630 521 202 133 390 820 44 462 234 727 718 656 55 61 488 499 119 327 96 482 922 775 74 477 558 869 984 725 889 418 642 194 99 974 8 843 162 40 661 313 518 918 578 731 175 19 148 304 310 138 …
Output: 11042

Example 2:

Input: 6 332 817 890 173 656 685
Output: 203

Example 3:

Input: 242 166 739 427 240 380 8 942 530 192 809 115 205 781 232 28 474 80 13 567 787 183 630 113 17 119 400 501 912 747 191 397 106 440 584 864 258 38 934 936 961 363 835 287 881 666 63 763 839 762 234 267 546 660 317 246 279 555 792 813 397 487 951 98 420 523 49 853 803 214 719 634 185 293 626 691 789 682 953 881 325 414 839 76 497 994 134 557 646 22 796 655 174 585 413 535 683 182 827 374 314 488 545 867 745 634 756 72 337 185 687 986 482 634 145 568 24 907 84 116 183 585 402 116 945 715 253 359 131 917 688 810 336 447 811 411 101 1000 884 755 254 192 533 286 663 625 620 668 49 658 714 979 345 492 822 370 135 993 668 993 38 260 727 167 463 569 126 101 783 424 453 21 110 410 353 516 23 249 717 343 734 498 474 267 186 825 699 5 216 930 96 919 290 21 870 189 361 381 126 58 250 656 841 95 578 856 …
Output: 436

Constraints:

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

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