CT901

Smith and the Widest Spread

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Every season at the port of Emberfall, someone must inspect the delivered goods. This year the task falls to Smith, armed only with the parcels register. 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 <= 93; -100 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 60 931795776 495487111 74461255 504949249 220320667 144421149 126739961 85446333 216597783 793998680 542490420 907907275 246971094 505180627 287060817 550994913 291327997 319064008 994276755 58815683 125825057 36464348 707954652 635294029 659380705 940935925 85548876 703693083 633320931 122353156 641311248 432799972 805654838 8535958 388623853 419574064 554425855 586918151 661160700 358584134 965604038 404982657 397832956 525426681 21958098 117460146 915187185 677336130 792991073 16511551 631851538 807721717 989187050 353627090 718224946 315620592 489550650 423002182 536002799 17590530
Output: 985740797

Example 2:

Input: 25 176229191 916072845 447334071 674364935 922422580 480564675 356437764 428005070 637094818 251981571 476344887 23603237 738318044 144550181 229580573 769719449 202235965 810014291 855206233 216943196 687772545 674684007 148673295 14212278 52659156
Output: 908210302

Example 3:

Input: 57 709286125 773312867 225526125 88897404 604728186 301275566 846481755 413723640 884796731 212918279 287767080 437749655 942264755 645074774 608643823 644768863 462996690 352427981 3567806 637067636 95229526 860855212 288010377 450159001 172048704 3646930 547832771 745213680 325851873 547795818 948159918 575987427 321146250 46162178 882378167 62952589 567921296 849307486 461756062 97841902 68597771 111575428 827996985 538702389 921969572 152415572 33447664 772817928 198875808 15193026 561094615 79962686 802346026 712169863 940868177 682454964 219397223
Output: 944592112

Constraints:

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

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