CT22351

The Widest Spread at Driftwood

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Before the gates of the quays of Driftwood close for winter, Nils 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 <= 760; -100 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 40 175340007 186872069 201402869 680897217 621359321 846027348 71120941 966211870 755119600 771293187 949501216 163399584 581462595 459520126 60083522 625866017 912784768 666973899 652232255 736992741 875094674 993861195 263745175 262884625 676767656 798189015 912996802 544355787 832994790 471660119 67795261 542685557 60068341 609014346 5041247 55827311 620354048 557081085 421823469 837073953
Output: 988819948

Example 2:

Input: 682 157853147 381070438 463312123 453357802 664435778 998016186 799015655 918238377 47887693 445109871 299519507 687767204 211115870 49799178 584949062 354622279 786918266 826567060 849557448 737177402 519188994 13922046 659487425 150281103 672680939 789699654 886515498 387266264 549177247 73239706 934086130 531090625 916039198 72034693 44808781 180818900 1217208 650328329 576658789 752722197 984388232 492740763 931495541 857060757 912554856 607495880 335600117 713824921 824263377 892885050 129152916 30070328 829792408 768493735 908954285 329651656 618381448 791099860 266079662 903322309 902589667 645198860 305912854 162305531 591699560 107022535 19512094 596326612 710831649 601885236 775415973 514143444 968885841 890647635 397556359 65263541 70440215 225715340 381443919 685855643 99492971…
Output: 997618536

Example 3:

Input: 348 291776025 81369391 767011959 358779262 571969631 951095408 400502273 482299361 630992398 318494807 397799203 288592143 351142128 142137648 163801745 791111326 938127700 598481064 401129037 854575165 154481597 675829782 850749645 850386799 999132877 456692528 215969242 95179718 974170988 935552200 86136528 781955986 280780051 663363088 851900327 73761041 398558909 646115214 968701531 527776496 109292181 885307340 397361472 81807282 874904106 701800484 358829724 116560887 898117551 22555531 348113734 727691550 357988450 490553821 309358079 870791766 196167677 260501772 246111569 113339430 968807101 830486999 908056571 382903962 58359372 302721640 407038010 649848185 45345454 420461051 980287365 555047615 319899958 471314826 851344260 584375526 993549081 897266416 414296245 416889836 3002…
Output: 995263957

Constraints:

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

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