CT1025

Sara and the Roving barrels

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Every season at the valley of Misthollow, someone must settle the inheritance fairly. This year the task falls to Sara, armed only with the barrels register. 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 <= 58; -100 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 56 396799 990856 362877 613129 472546 580548 393478 997868 502277 65069 954160 516947 557011 769855 985963 872410 904021 376724 855166 118520 22929 879913 580381 661163 530785 315539 13550 83344 984528 685367 289896 813342 2827 915514 169944 878744 749769 905767 769837 129641 163824 878881 594747 932144 260419 489496 316563 17154 664883 161635 815610 866600 197201 278921 146476 737952
Output: 995041

Example 2:

Input: 3 650720 660072 714418
Output: 63698

Example 3:

Input: 20 483898 371434 593511 955926 64894 109177 396032 209914 513367 110493 569045 469207 705402 265299 916938 16864 945874 893974 915148 299589
Output: 939062

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Sara and the Roving barrels - EASY Coding Problem | CodeTikki