CT24694

The Widest Spread of Gusthaven

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Caravans arrive at the windmill fields of Gusthaven with crates of readings, and Chavi the surveyor must account for every last one. 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 <= 896; 0 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 561 845649 147647 742764 701870 51095 947236 804868 497606 242364 34096 811361 534155 187754 176332 774350 536014 232550 125413 567668 946147 749379 56773 489420 337551 172153 109597 477116 414805 855233 164301 916954 336803 683279 831843 374564 685396 697271 36504 124704 179894 188154 496391 414022 418893 675181 710051 944622 776363 922200 791757 740839 632679 291324 932402 989029 131779 681009 999535 210830 354255 467639 207386 580176 743182 363630 909177 780561 152414 665253 41876 970628 890514 275133 887594 594807 177604 959366 973748 290674 50236 71704 62882 827897 354545 653418 249761 920803 96040 231212 212418 379020 182599 170184 353946 67051 227093 600705 825619 669385 528364 138483 641572 606495 280929 409868 959512 324251 512302 37281 423146 479612 953041 829436 272645 251325 60…
Output: 998456

Example 2:

Input: 878 148578 249942 502187 503825 883018 256750 44525 848056 908176 563528 453645 424505 708470 318175 549107 54398 641346 784913 585844 523993 384857 958657 181900 173682 192559 489830 46596 652598 935434 892862 652113 240451 987849 144557 122019 185029 108783 728637 520626 107774 442877 102220 366151 7306 764961 653344 386919 607516 564607 143339 957212 708789 883923 206053 716265 286105 641487 479377 523290 673433 781884 91597 612971 347050 890904 614570 788007 552371 918740 983609 656076 337707 93139 159299 778740 355863 814905 600693 835353 838252 450273 616203 829367 741747 832560 688407 770689 960828 2841 935372 951773 684258 936668 786225 583468 161960 989813 426694 187537 970219 250689 940458 769470 622500 18296 140108 701076 804207 974054 218999 366375 279216 64890 699654 110012 33…
Output: 998923

Example 3:

Input: 127 581348 833734 364953 974112 124084 710487 351710 205652 490963 930889 824304 614244 331482 529910 818966 297956 919402 783417 237257 792339 209154 979406 674004 140912 218823 953060 372111 971264 357379 994258 471220 550087 73473 584187 198313 559426 373705 840345 363899 95217 609846 507180 918008 972943 602892 529834 291917 154428 973025 324515 933675 173436 979351 617586 720613 336076 119662 457019 453436 58601 31353 489186 705281 521049 37483 957158 882215 419743 135957 475602 455736 800062 682360 342926 50316 412805 900190 642973 87801 962170 91405 841999 363631 240044 280782 972038 757269 485943 685329 575486 918277 715740 770483 674896 902997 512900 661468 604159 705006 271211 780097 925375 550437 854608 606108 539150 99040 281772 358393 613622 521336 418279 673200 764933 151932 …
Output: 962905

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Widest Spread of Gusthaven - EASY Coding Problem | CodeTikki