CT27094

The Even Minus Odd of the Faded scrolls

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Morning light hits the clockwork quarter of Gearford as Jessa 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 <= 248; -100 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 124 -37 570 -13 660 267 743 -70 710 872 877 802 212 -44 552 150 773 600 -82 593 166 515 561 654 -50 621 278 173 -90 41 -63 877 344 577 485 980 500 901 988 838 93 782 302 280 820 178 372 716 -24 -57 892 935 -37 918 218 706 994 288 592 240 425 873 169 567 691 362 399 466 73 622 208 -93 139 822 211 870 327 27 248 118 475 947 66 758 760 125 909 715 656 402 594 775 217 854 587 791 252 98 831 412 87 857 161 619 561 861 413 99 428 78 338 197 980 521 1 -7 719 74 851 625 544 174 531 396 307
Output: 2774

Example 2:

Input: 135 647 866 442 30 407 289 41 762 328 526 637 285 249 347 837 575 163 156 722 748 321 870 499 821 513 92 161 745 820 974 531 715 716 -20 -96 -52 690 301 128 984 860 203 431 813 -71 166 142 163 476 327 152 39 710 485 635 477 743 211 769 769 516 896 830 683 513 262 635 -89 272 -39 217 -89 484 -7 734 789 -74 625 19 712 253 858 425 249 987 291 186 492 599 775 553 173 951 904 373 185 736 795 357 159 939 678 386 807 44 156 703 78 167 906 842 515 -72 270 361 566 17 439 37 607 801 288 350 -31 709 850 404 360 597 172 419 488 432 531 161
Output: 495

Example 3:

Input: 197 173 278 657 -10 930 -17 812 55 441 773 772 635 698 129 877 589 395 943 871 194 923 91 506 313 528 499 582 871 -30 985 7 697 958 77 800 773 680 661 585 83 358 495 174 340 754 324 416 135 253 41 773 -14 165 -91 230 258 984 143 35 215 998 376 476 483 432 267 753 483 835 33 2 413 379 737 233 950 305 91 286 887 -73 568 -90 235 196 1000 546 659 843 464 110 311 371 292 393 -32 741 -78 774 556 898 179 382 305 -36 434 643 421 241 -55 384 970 998 446 584 233 348 861 993 499 319 528 -55 704 154 44 -33 818 680 657 563 708 514 31 640 652 114 964 650 272 71 230 20 549 936 896 203 270 736 230 679 13 934 820 -10 673 709 628 874 227 246 621 355 898 802 363 -100 699 282 227 539 703 423 734 -97 690 25 537 280 540 507 -25 766 16 83 -44 119 -61 165 729 593 192 506 606 66 178 867
Output: 4407

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Even Minus Odd of the Faded scrolls - EASY Coding Problem | CodeTikki