CT2228

Brevin and the Dusky scrolls

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Legend says the vault under the fjord village of Deepwater opens only for a perfect tally of scrolls. Brevin means to find out. 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 <= 40; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 6 -713959 802416 -453211 328423 64644 179527
Output: 2

Example 2:

Input: 32 836893 -32234 871093 -571711 -655620 744407 144626 66600 -849238 307808 -590074 -371619 347177 586612 210621 883705 973469 625677 -698501 -906954 750819 -230209 -701472 529870 820258 -972767 -568956 476477 -290931 -228947 -330685 -315514
Output: 17

Example 3:

Input: 19 -246216 -312450 744937 194556 364918 318384 -11112 -93499 938491 -192200 -261475 -55230 -141169 -516342 713265 334553 58625 609546 119286
Output: 9

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Brevin and the Dusky scrolls - EASY Coding Problem | CodeTikki