CT903

Ivo and the Widest Spread

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Morning light hits the ivory gates of Alabast as Ivo unrolls the day's manifest of stamps. The tally will decide the next shipment. 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 <= 70; -100 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 11 108775830 199630896 292823204 585204081 743789917 143009014 398673361 404916015 738754277 868849723 813916688
Output: 760073893

Example 2:

Input: 1 944828544
Output: 0

Example 3:

Input: 64 446998194 219655661 770494306 201176431 377744879 151970956 114314216 374764775 289195154 473491405 571592902 68364138 536605656 550257 441469374 55376541 768817171 429130986 406823679 831860857 402358469 532660486 377165546 289669028 130336572 304636194 837813144 184138656 591831969 225220888 941462534 382647484 310311125 754424621 328084385 814121997 726394639 734983882 827586603 167283186 619107911 578101830 980956649 372494053 932117829 604942093 485844675 978507614 977510549 586181486 942926930 921800965 367606277 559405302 536267715 333776161 248517545 555224193 884489556 90029839 650885466 743096386 165857819 159047392
Output: 980406392

Constraints:

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

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