CT26830

Sailor's Caramel Ledger

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

In the steppe camp of Horselord Plains, Sailor the auditor keeps careful count of the barrels. Forecast next month's demand, 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 <= 868; -1000000 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 308 -635489 -197256 -766857 -211940 -415565 -241225 -188856 -690511 -831583 -509737 -372266 -798240 -163005 -272182 -467347 -768538 -74110 -799990 -446405 -814403 -177592 -964695 -121246 -975935 -928707 -700987 -194926 -369190 -467463 -86444 -219609 -802881 -130964 -693129 -153333 -754246 -299592 -521454 -750940 -752179 -262403 -805872 -529912 -558552 -395096 -23640 -768542 -129401 -353671 -124978 -569522 -802898 -806111 -919055 -527616 -584888 -547395 -192839 -879234 -139819 -672677 -369926 -641509 -178474 -365396 -530370 -814162 -581474 -486207 -187929 -345965 -761898 -964843 -548269 -400654 -232315 -983869 -19895 -199024 -892492 -426545 -2499 -682550 -845885 -919288 -356945 -783444 -920006 -642689 -252870 -63148 -305928 -563675 -702332 -857950 -207101 -175751 -60227 -261161 -593777 -496…
Output: 997719

Example 2:

Input: 746 -31436 -725675 -646937 -204160 -237218 -352347 -52930 -827507 -544425 -368092 -902626 -835197 -530250 -183559 -548205 -980762 -88288 -765152 -756593 -303665 -97745 -783444 -583853 -125035 -86810 -603621 -463830 -651535 -296558 -355001 -583222 -141614 -419332 -641483 -395392 -59127 -78374 -552248 -585570 -383911 -68820 -579175 -509010 -371375 -382672 -465180 -833560 -551758 -19960 -993456 -325049 -559362 -619315 -152041 -488748 -606790 -16538 -787806 -596997 -742923 -6219 -927087 -567579 -677358 -218898 -563901 -483111 -508174 -451291 -677354 -52779 -673161 -319613 -313639 -469288 -794052 -264303 -239953 -134093 -387222 -39928 -704678 -779220 -299820 -900177 -978790 -992799 -146125 -257647 -267522 -72931 -62634 -854623 -308987 -644421 -145121 -931761 -200068 -770689 -453564 -883544 -222…
Output: 997681

Example 3:

Input: 516 -814947 -991933 -299363 -887812 -52575 -691608 -768917 -760406 -701884 -374367 -759992 -35973 -314854 -795970 -494138 -67164 -84368 -840908 -398419 -235498 -766546 -944987 -42370 -358516 -883434 -758069 -323995 -773751 -985228 -994357 -978966 -174782 -250412 -896646 -600263 -13668 -717232 -832480 -334377 -258233 -687467 -116830 -993798 -715604 -345015 -705 -949170 -613251 -208100 -547443 -715535 -546662 -949197 -646882 -563709 -464315 -877877 -470002 -22799 -547766 -333421 -905617 -841400 -449227 -993098 -705258 -308621 -919640 -193253 -807272 -921396 -695243 -535057 -984209 -857812 -962810 -108980 -266451 -733953 -915657 -746159 -103136 -605480 -841823 -605784 -794615 -369034 -996492 -424678 -879829 -434877 -297507 -621738 -696013 -932727 -93814 -893816 -215648 -154223 -510694 -807786…
Output: 997381

Constraints:

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

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