CT26008

The Widest Spread Beneath Ironvein

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Lysander found an old ledger of barrels in the customs house attic at the mining town of Ironvein. The margin notes pose a precise question. 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 <= 558; 0 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 135 456 238 296 811 748 973 499 612 29 289 221 700 513 696 931 657 556 273 952 806 623 597 605 583 629 906 4 313 369 609 987 249 735 749 902 409 750 652 501 47 697 216 380 125 314 938 493 677 306 135 96 868 109 154 399 76 593 423 253 191 106 391 633 58 780 159 410 525 891 309 161 644 257 442 112 432 374 250 667 820 65 70 175 332 532 796 900 989 491 347 836 101 405 441 859 291 986 442 559 858 168 666 67 102 82 223 181 751 509 854 918 264 29 353 100 960 124 545 133 309 533 944 68 625 235 250 168 0 519 320 18 480 203 808 508
Output: 989

Example 2:

Input: 383 263 549 143 660 724 155 558 453 732 668 624 541 597 51 495 515 204 415 428 195 802 318 573 434 906 696 325 924 613 640 84 958 526 332 690 496 539 481 478 773 520 814 18 779 992 288 302 756 135 209 114 456 507 868 559 431 425 46 358 318 181 456 83 649 66 410 58 531 377 516 643 665 785 641 68 470 736 596 367 368 91 811 849 597 185 140 482 104 235 983 75 571 797 41 0 747 6 945 286 83 826 957 334 789 602 638 352 609 764 460 950 723 347 780 289 450 142 171 467 43 206 529 960 886 678 741 665 491 465 147 764 993 742 748 982 487 893 440 579 987 597 299 965 224 930 78 644 217 828 870 349 829 469 451 818 140 260 707 135 456 263 203 819 368 528 582 905 547 108 580 557 470 914 477 574 937 483 463 56 37 93 774 357 902 507 63 321 251 338 942 625 930 700 386 877 844 371 935 619 875 973 942 108 410 43…
Output: 993

Example 3:

Input: 256 590 656 506 413 483 742 613 34 217 531 919 726 370 941 509 381 319 371 166 291 636 769 426 886 922 356 253 316 118 190 402 518 745 778 371 682 220 611 182 473 284 47 784 201 648 930 470 961 381 475 158 405 188 187 865 486 833 520 835 362 583 296 735 162 52 460 882 108 753 962 965 45 579 650 496 268 437 733 260 922 142 90 593 672 156 432 851 182 783 821 391 973 338 819 21 495 974 108 322 583 755 597 662 96 985 704 581 670 954 819 983 65 447 316 185 720 114 270 758 796 60 830 63 528 325 232 48 213 306 470 818 98 333 645 642 160 992 193 540 339 787 728 513 199 331 24 295 138 518 823 837 453 480 426 755 796 428 455 765 741 760 783 861 669 419 923 136 869 103 659 446 431 98 704 46 608 635 881 589 75 849 989 984 276 978 300 383 687 766 218 801 527 732 185 459 869 518 945 537 925 341 585 812 …
Output: 979

Constraints:

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

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