CT26260

The Widest Spread at Saffronia

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

It is audit day at the spice bazaar of Saffronia. Bhanu spreads the crates records across the table and picks up a sharp pencil. 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 <= 492; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 404 706241 -437744 570246 -655358 -591659 -153253 -334409 64112 37953 153031 172899 -614728 -331888 -828644 430132 999800 294243 984286 348386 -417587 -23134 725455 -441453 812091 -291589 525886 -592883 -528570 -732957 -490894 693832 564271 -59212 704235 843965 -868149 -917880 -12193 598766 -156443 -412059 194254 77298 935256 -597117 839329 -388544 -994531 -664936 743204 -398467 -386228 324579 -293035 -775084 189239 251986 -228383 -327055 938562 181760 -836182 -622443 -254689 -530907 -15433 874339 -785027 206854 -30951 -401914 232818 -949229 877225 260687 701468 -363112 -505621 -618930 -993319 31220 917572 147110 475351 -753011 933909 856150 -961188 -872182 603180 596192 180180 275413 184342 -36073 -4328 -966118 855220 964353 505656 968769 -168478 -853954 488850 -236322 380059 -328338 2472…
Output: 1997827

Example 2:

Input: 260 -539681 416867 486167 -991898 -511632 287917 911071 729757 -576138 -521433 -152361 868836 384942 -909182 371338 511339 251315 631382 347871 930664 659873 488502 -423735 125429 83184 734820 -178558 668544 36694 -437255 91039 -599892 168014 209167 -665804 -590035 -20908 -724722 -495524 516305 168039 108938 831008 194209 -338152 294957 936374 -489509 590539 998379 961840 648282 -513099 585410 -884706 -953205 -748114 542117 -828903 -213185 244412 -358084 741111 787761 251204 -147769 -319981 768575 -997182 -890049 924173 -684 -828852 89212 -807760 719070 463546 -566573 -895689 -101098 665420 803597 975142 746448 -458471 -60284 -105410 177700 -411456 -972270 -338090 635946 442467 -15886 694904 621631 -988117 -919435 -686587 -837285 735172 -394581 -923138 -750714 849211 -727008 641096 -991497…
Output: 1995561

Example 3:

Input: 225 -926764 -226643 -754847 456410 645066 812878 -915320 -806802 600863 -210066 827396 -262313 721613 826767 661420 -990480 -62928 913384 -803602 133252 833435 -390265 475734 -566873 126338 -413067 884692 168002 874573 -732860 445460 435041 -978291 -291409 -888442 806659 -951983 111358 -593751 340614 -673227 -224871 377009 41169 81598 122190 751319 -929323 738152 -531969 -564717 91008 -424473 -439159 -355792 -567658 628980 454178 -908805 645 -610248 62388 221089 201146 -24396 -731137 -929653 117555 560595 -248025 443001 697732 -684848 -421131 -87769 265478 23076 136832 -268588 915361 -275788 724648 561346 500660 -226334 792336 704773 980848 755831 569748 -696675 -146874 817172 -310064 5840 -240512 -301816 -981807 958106 236824 510120 -377524 210857 -283240 892616 535613 -99014 869031 -9787…
Output: 1987587

Constraints:

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

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