CT911

The tickets at Gearford

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Caravans arrive at the clockwork quarter of Gearford with crates of tickets, and Curator the reckoner must account for every last one. 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 <= 87; 0 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 75 460205 605792 629956 781874 736520 706900 653391 958319 785888 833556 200747 569751 655991 912630 994537 688854 114625 456386 417537 204938 764546 646668 137746 350205 359357 897905 599701 417682 873577 492517 296404 39248 281179 503936 166821 483386 993409 758982 56506 261947 523059 29978 726832 152635 899274 679292 827518 917505 793230 78701 88596 838471 930159 13672 365791 778644 274399 959838 747322 612218 980833 621189 836758 808468 976099 401115 813528 18078 3651 243886 201839 814550 309216 632898 442773
Output: 990886

Example 2:

Input: 29 741625 109246 739985 587079 513655 927614 318638 281565 752204 526195 68784 363457 799673 218483 749903 767806 725117 267974 555286 357065 25170 687963 390205 331041 372865 441019 899029 362787 457578
Output: 902444

Example 3:

Input: 4 956255 934403 4884 474576
Output: 951371

Constraints:

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

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