CT21401

Last stamps of Jace

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

In the opal reefs of Shimmerdeep, Jace the dispatch writer keeps careful count of the stamps. Inspect the delivered goods, every figure matters. Task: Read n integers and print the difference between the largest and smallest. Input format: First line: n. Second line: n space-separated integers. Output format: Print max(a) - min(a). Constraints: 1 <= n <= 272; -100 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 151 481788 978188 575598 56809 405400 407575 748149 933773 821332 975440 59527 134492 800952 122762 930499 735599 672530 700397 436625 166894 972463 569571 961418 911740 919328 966367 24493 70940 358937 264065 416357 753325 654489 158584 964030 667061 366918 79211 146635 962543 755075 571049 23054 35333 949875 252292 888373 387158 174501 943167 141951 427089 749681 239767 633880 297029 81241 172665 379588 381895 157044 867563 570715 425683 60978 345789 713413 446103 315137 313911 381663 85365 171985 200102 477668 958347 977858 872182 586628 933352 651495 399000 887739 297488 450788 427746 15576 614339 607840 670063 148330 11936 655249 165356 778054 720740 721759 573055 612031 246064 573550 184225 756899 481955 87879 766758 1406 270 18060 637372 49663 726643 746100 409602 139202 149152 891593 463644 9315 499358 699932 88519 935262 650268 634536 120055 220189 807273 987624 125720 264569 661019 215048 184266 800424 332075 69982 227995 945354 394318 345820 474916 613210 162276 607452 533286 930260 838603 632876 604109 345897
Output: 987354

Example 2:

Input: 84 487509 180408 83596 383333 552922 977018 562863 995747 469790 362121 727772 710542 998219 40045 255144 792567 700919 130489 535186 745699 380119 926380 708313 160190 964403 81505 369720 693461 886903 622865 650036 29605 180058 996697 259310 922395 690078 761997 220698 982834 135199 364733 977468 401004 411449 335611 122949 667506 90150 614399 275936 361182 173601 360964 550110 232530 668388 33719 363812 898232 467243 805434 86323 413835 911412 852342 809487 737944 1769 862204 480888 997735 389594 705363 861315 977539 66840 144127 894241 992682 280947 724654 801630 317514
Output: 996450

Example 3:

Input: 235 205191 22893 843307 701901 365386 157351 638778 917591 190294 776055 738007 78553 817738 657896 703369 595710 430947 126272 864650 82965 817662 274951 167349 633137 740992 886791 520023 272492 482370 444243 452672 516360 497822 351996 79700 88081 595430 378580 192612 157738 177719 608804 980490 124339 88020 485917 978053 841922 5462 360974 437827 930984 668262 310191 30589 277335 570136 676006 401763 112684 971166 802529 240151 371352 680789 200445 733510 301072 508630 872590 62750 49138 244197 406888 883068 578866 487586 350600 18824 84483 272781 713013 257977 437037 43744 632343 626119 480877 285971 175369 725357 463272 796063 226981 778443 164568 531124 76176 691522 379775 487976 58956 463196 973436 797684 551088 144066 550180 982481 328632 663858 340372 346659 483563 384188 585555 107693 432691 257880 991756 789822 288226 778275 859232 41426 845533 570022 388788 965002 553291 551759 205122 529764 779019 177653 863720 854536 616313 287066 9138 295169 897751 369507 555024 289755 526087 620955 465668 491966 734452 924546 956470 800748 636534 707676 398431 183609 298719 654479 644565 29082 400534 105993 603728 102293 655675 629509 714294 902879 88636 675399 912954 219174 306265 960126 130464 482571 562084 350695 998208 585387 83951 591621 512416 987437 925838 856060 627353 988076 648340 850427 235249 257113 797592 336728 83038 805997 868279 801119 982738 145024 94485 28011 304009 690605 596971 973815 516421 284079 656160 901203 47185 64716 606753 364050 768760 819629 288235 604393 892202 281022 157396 558832 147690 146644 208008 527064 816456 234780 430724 724207 480882 235155 943652 479393
Output: 992746

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Last stamps of Jace - EASY Coding Problem | CodeTikki