CT660

The Widest Spread at Willowford

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Freya found an old ledger of tickets in the aviary attic at the river town of Willowford. 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 <= 100; -100 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 96 186 24 373 921 973 315 -1 559 754 121 841 362 40 671 763 231 82 668 -99 872 562 -13 994 802 699 15 6 956 775 717 297 172 245 473 225 804 -84 215 696 975 177 503 344 763 803 685 775 235 533 995 -95 262 867 228 35 203 334 719 682 591 625 -86 577 -25 34 197 485 142 415 186 643 596 -97 457 139 265 518 507 666 541 473 939 882 281 786 291 541 836 810 -23 -53 -82 928 669 35 124
Output: 1094

Example 2:

Input: 15 472 711 549 893 102 351 557 371 875 575 455 209 163 575 686
Output: 791

Example 3:

Input: 31 379 114 416 721 397 262 439 -35 309 617 734 418 492 890 644 231 854 311 309 309 437 962 641 535 24 204 59 207 717 443 -55
Output: 1017

Constraints:

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

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