CT25752

Farmer's Widest Spread Ledger

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The surveyor Farmer has been asked to settle a dispute between crews. On the desk lies a long table of readings readings. 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 <= 594; -100 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 290 749 269 609 257 968 392 761 13 810 609 66 978 -69 134 728 360 383 548 726 924 227 384 311 513 589 664 869 604 570 215 985 24 230 992 489 630 321 671 391 504 967 846 725 81 516 365 661 682 608 -83 544 491 158 26 497 -91 -76 134 524 382 -62 545 182 589 475 -30 916 873 -45 475 792 22 130 360 599 762 -83 925 283 270 582 317 205 826 204 185 -79 360 667 172 276 87 50 194 410 409 582 188 87 790 574 203 539 222 970 -13 955 399 212 103 756 834 524 181 931 105 557 166 257 218 232 730 19 586 603 926 860 484 885 203 838 145 396 987 -80 619 947 938 916 110 248 253 506 849 191 -53 464 50 918 112 468 746 241 529 397 446 233 -21 888 -11 -14 439 801 609 759 626 251 243 593 38 875 -67 100 273 167 849 669 468 968 31 975 832 175 518 585 730 40 453 805 380 546 819 115 420 641 609 243 431 839 -76 541 298 1 …
Output: 1083

Example 2:

Input: 576 568 841 490 35 662 -52 6 639 334 907 216 474 993 93 -27 575 364 807 552 984 -86 723 472 846 16 563 686 -6 228 200 946 971 139 262 650 515 508 742 182 129 286 347 33 497 155 447 397 51 204 68 7 -21 289 566 211 428 890 315 706 658 865 -86 684 111 723 632 613 149 575 411 342 798 656 534 774 792 145 236 457 888 573 271 389 89 28 629 841 50 199 270 877 323 957 179 782 960 910 284 224 -23 613 74 846 683 280 701 765 327 23 250 -62 765 422 842 66 405 158 330 713 31 716 1 718 798 620 586 -65 141 1000 52 343 413 79 639 857 36 799 238 114 583 610 -39 63 487 171 502 -31 703 -80 422 570 221 968 -6 820 573 369 368 275 446 823 955 764 372 622 679 -75 850 367 146 -98 771 311 414 774 -8 290 740 996 -59 13 187 106 317 265 22 -18 97 -65 467 200 29 381 165 194 531 237 734 817 764 563 529 -11 633 -7 859 26…
Output: 1098

Example 3:

Input: 60 -82 431 326 671 824 37 -77 352 956 516 784 215 86 338 519 180 263 80 91 -100 185 752 529 518 495 205 -84 817 962 117 -59 115 216 851 877 422 741 922 335 81 315 994 859 449 113 471 572 658 672 172 226 819 497 524 -6 276 648 143 947 132
Output: 1094

Constraints:

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

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