CT917

Last tickets of Bhavi

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Legend says the vault under the mulberry rows of Silkmead opens only for a perfect tally of tickets. Bhavi means to find out. 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 <= 65; -100 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 29 261204 634083 331605 537122 164859 450551 77993 309134 608475 836829 68661 723670 480865 140568 888663 730652 251882 839143 386929 557842 41469 94508 470652 72932 303812 760200 943343 528272 560394
Output: 901874

Example 2:

Input: 53 10325 253332 530637 308364 84407 551993 515894 417600 194839 243956 207011 158144 593093 201282 79779 608478 623804 489022 104770 250366 771605 305016 546457 501662 881905 848879 950580 976161 948795 866409 858286 252985 420959 606170 672421 229092 705236 552174 982596 803577 125717 982600 372494 322962 385453 511063 866456 691678 736614 802782 981421 533550 275391
Output: 972275

Example 3:

Input: 26 313022 228421 147330 752080 21278 960208 571725 361848 969838 520348 55538 422190 809926 283482 551092 445564 164419 613459 875363 3770 96436 571248 281332 702451 731964 708666
Output: 966068

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Last tickets of Bhavi - EASY Coding Problem | CodeTikki