CT885

The readings at Needlepoint

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Before the gates of the pine barrens of Needlepoint close for winter, Silas must finish the readings ledger - one figure at a time. 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 <= 35; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 28 670222 985378 166425 81871 332666 -356043 771221 820841 611771 907267 -215704 -725352 842274 722384 669379 -976668 86744 543769 902494 -876095 337818 -149674 -639773 821117 752592 -897304 214843 422723
Output: 1962046

Example 2:

Input: 2 -294669 290299
Output: 584968

Example 3:

Input: 17 29267 -855726 882843 371950 287535 -338839 -946660 -78091 -203713 576546 245736 -555161 -174050 832581 -1458 -738534 293518
Output: 1829503

Constraints:

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

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