CT26243

The Widest Spread at Gearford

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Deep in the clockwork quarter of Gearford, Felix studies rows of parcels entries. One clean number will settle the guild's oldest argument. 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 <= 555; 0 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 549 752139 169561 466789 202940 191818 89608 457769 602908 392799 214297 508327 454287 485493 371291 826801 425867 875080 934037 433664 517567 692833 647724 419644 342431 428738 392672 926673 927943 282289 530005 77857 301862 347317 342837 611408 582437 562381 120622 93740 109195 342351 437327 461730 569026 602446 506219 645528 570368 153080 29349 192748 185049 956606 804867 443735 478038 144127 30616 689134 848820 909264 503763 209338 629957 36464 226583 513954 767784 867707 879593 944907 937690 844904 425900 947016 909387 628119 905307 921799 483321 18192 130388 487691 868403 344497 488745 340425 849862 31018 33857 428985 232687 94443 295047 141231 769314 859453 832834 83200 223175 421087 6106 420460 153862 170989 495942 325601 366 180196 610110 303760 911616 29127 304251 436581 803335 8…
Output: 996826

Example 2:

Input: 315 311501 80963 996241 69433 312931 601432 798092 334649 638434 351635 904053 804566 976084 157935 854752 881687 648860 411586 830816 357739 189409 836276 412156 196531 46219 542685 267206 984508 989767 517850 521052 322942 126895 221115 643512 811500 909819 301985 32064 579678 363592 345561 315528 842201 76889 156156 834688 347803 483676 430837 90871 270902 281061 438843 86211 526501 385116 19456 809238 41379 553827 682414 311870 139438 459136 564590 810411 878208 53417 168834 701838 12970 366517 226190 912799 130162 886756 497920 392454 436377 213182 515986 45877 519430 454726 50765 776325 926263 860503 271040 237642 209031 486312 17346 651379 454702 408772 60424 826521 291209 626243 279108 550619 422485 872702 109497 67827 245972 533512 203056 124876 150656 162271 455165 611452 395450 …
Output: 994508

Example 3:

Input: 176 939635 374659 180761 124587 701737 409096 635611 604054 670781 176363 636829 817727 727693 406045 677277 900657 432960 998560 119964 18723 323394 584469 905481 820269 533373 366553 87532 715079 890919 990944 215097 227517 821969 180583 801092 713424 541779 918939 267553 906361 840133 514775 426223 209910 726053 951862 451887 786090 456210 494288 13667 221588 78621 293818 739449 883542 811515 919429 130109 613794 572346 959845 419942 164583 536615 174589 90573 505569 827682 687131 877527 607248 699763 272591 20079 513418 791347 683981 666346 978861 791580 927860 609111 216734 518772 990663 628494 914422 710277 116559 849541 512337 82447 227355 807508 486987 406859 892928 285160 109591 971091 114728 106436 666593 312560 312120 251059 959482 23526 154653 370341 737233 30720 230697 423972 …
Output: 992453

Constraints:

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

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