CT21511

Quin's coins Widest Spread

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Before the gates of the old quarter of Brasshaven close for winter, Quin must finish the coins ledger - one figure at a time. 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 <= 250; -100 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 164 443996 338353 201052 869080 32696 21306 362859 397095 943182 848919 652939 140746 759712 269438 350387 526002 586509 304867 785209 106315 841546 235064 714260 75010 90833 638896 429964 530188 93730 498322 237058 904586 542831 952946 696113 36958 719383 811767 275641 173033 541735 598177 944974 158923 679432 116381 645067 703329 201920 885172 725132 968187 669571 847111 528337 699970 90023 867739 652474 937741 748579 542285 625446 277348 132201 563288 122488 221047 693476 307338 465235 805354 766620 89475 863004 842456 872994 323076 290646 487097 142694 150027 958075 450654 463309 458820 563533 952869 882147 118824 404066 579834 759577 649591 570379 320711 698638 514490 817603 921922 843831 694074 633830 538839 801685 911253 106678 324384 535681 960056 41935 26630 884860 428847 914128 506089 972325 188949 282333 983632 574668 456157 781700 862589 920033 536236 742454 547764 782372 343892 58858 472288 654466 767006 94369 518141 80093 395958 721849 234019 647420 149242 647020 679242 8505 742022 614800 929583 957225 820216 586540 710379 873031 567857 133547 530682 692158 749012 520653 899397 591327 512357 871395 108417
Output: 975127

Example 2:

Input: 77 752776 342210 33015 496197 717995 345338 185234 158003 366694 130451 496464 59839 830276 264457 199295 976450 34274 379556 808577 232188 551904 88322 128973 312345 71520 584177 242682 520614 395506 871688 181382 709941 601133 436850 842697 930017 991037 994614 728277 833998 366381 861945 858550 412750 743188 530928 658451 563999 155290 952723 529147 267137 128295 106668 872766 240324 665923 851855 23310 31029 639182 649694 63580 409995 933209 970507 83761 319146 424986 963045 691318 778289 246898 105962 62729 798963 889128
Output: 971304

Example 3:

Input: 7 372730 258842 110236 546078 421036 532639 182740
Output: 435842

Constraints:

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

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