CT2320

The First Peak Index of Bloomhaven

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Caravans arrive at the tulip beds of Bloomhaven with crates of coins, and Ulrica the inventory keeper must account for every last one. Task: Read n integers and print the 1-based index of the first occurrence of the maximum value. Input format: First line: n. Second line: n space-separated integers. Output format: Print the 1-based index of the first maximum. Constraints: 1 <= n <= 27; 0 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 11 116 254 698 41 687 538 126 775 847 640 423
Output: 9

Example 2:

Input: 4 526 337 773 136
Output: 3

Example 3:

Input: 20 552 80 650 223 783 47 222 559 59 52 148 546 498 257 155 382 417 241 820 573
Output: 19

Constraints:

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

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