CT24657

Scribe and the Widest Spread

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The council of the railway depot of Cinderline pays by the answer, and Scribe intends to earn it. First: the full register of parcels. 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 <= 654; -1000000 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 72 -342779 -135942 -279440 -119158 -686881 -469697 -933982 -200985 -585061 -736958 -471203 -359060 -873036 -677571 -152994 -863186 -186443 -355146 -792377 -221747 -797493 -894388 -129862 -93894 -381119 -267050 -914331 -41009 -728416 -358867 -154361 -176462 -611301 -117456 -176208 -899764 -286313 -960165 -67267 -174204 -249943 -155505 -171624 -951438 -997270 -848744 -305158 -18559 -8437 -56742 -675535 -146758 -859721 -642420 -609609 -87532 -764596 -871230 -707718 -227119 -850489 -209451 -299867 -792315 -684032 -832269 -94367 -194302 -785393 -460519 -295826 -549279
Output: 988833

Example 2:

Input: 119 -112952 -479861 -955290 -675115 -644419 -251795 -666453 -107099 -793455 -639659 -619511 -917754 -905508 -930661 -460975 -161991 -791926 -630335 -625061 -166146 -115164 -585202 -304977 -24005 -44713 -25703 -716080 -971052 -402761 -323102 -187327 -494242 -535231 -247341 -180424 -549838 -990870 -879766 -63342 -682557 -124921 -954472 -17213 -195888 -544341 -549135 -359127 -136190 -950026 -632948 -191291 -149730 -928850 -516467 -606463 -551572 -76628 -66400 -227369 -568307 -234448 -216018 -583104 -567602 -764925 -845948 -340114 -260297 -385263 -372119 -505893 -347990 -461186 -288989 -824484 -438654 -861115 -430697 -769366 -757861 -781862 -53208 -323551 -87479 -146012 -80672 -626013 -966502 -691785 -962521 -674307 -434835 -600596 -821227 -466291 -858343 -146681 -689358 -97389 -500826 -521095…
Output: 973657

Example 3:

Input: 106 -983710 -345807 -88891 -20335 -688500 -507644 -290529 -808197 -105305 -550506 -363105 -542728 -13554 -113864 -63159 -953399 -29471 -402460 -768435 -303182 -657999 -960105 -573461 -485608 -140045 -512910 -827473 -151685 -56150 -957501 -707652 -668773 -119759 -371450 -755696 -210682 -442214 -277330 -929982 -557042 -806493 -37097 -971654 -731906 -78368 -154938 -889810 -525653 -510903 -582064 -533335 -588463 -418542 -533130 -870081 -948999 -790794 -557615 -311616 -74963 -686160 -454106 -280317 -84857 -327880 -714513 -159387 -124834 -617141 -809737 -737956 -925088 -889285 -537038 -51127 -308198 -767123 -291246 -625096 -704657 -377858 -877314 -98202 -696638 -226632 -601080 -294355 -293885 -216203 -916622 -892188 -885056 -996406 -886322 -842679 -20247 -863037 -427367 -607169 -511876 -972365 -…
Output: 982852

Constraints:

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

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