CT514

Last crates of Owen

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Deep in the monsoon port of Rainhaven, Owen studies rows of crates 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 <= 21; 0 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 15 0 2 6 2 7 2 10 2 3 5 8 2 9 7 7
Output: 10

Example 2:

Input: 1 5
Output: 0

Example 3:

Input: 5 4 3 7 2 3
Output: 5

Constraints:

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

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