CT28781

The First Peak Index Beneath Scarlet Plain

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Wren found an old ledger of stamps in the cooperage attic at the poppy fields of Scarlet Plain. The margin notes pose a precise question. 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 <= 345; -100 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 255 378 776 836 331 -98 327 329 736 87 239 186 559 -77 270 806 115 637 513 204 230 594 -31 518 990 519 371 83 993 315 125 241 291 407 884 625 -82 963 62 876 843 36 311 -72 -68 767 -64 995 12 258 42 727 806 171 455 587 -95 495 988 270 -55 186 812 901 205 458 921 395 938 793 189 -20 278 912 365 173 20 601 882 547 666 -14 366 879 948 227 436 573 661 451 617 591 -2 537 -56 827 758 724 768 45 673 454 688 285 287 918 72 352 468 959 -99 828 603 671 540 235 331 80 414 313 166 473 -63 903 193 512 453 252 664 632 256 378 660 324 793 292 632 470 746 88 675 970 283 201 288 668 779 710 6 919 593 -48 231 374 964 273 523 625 325 -48 195 270 -30 -17 977 284 458 939 830 711 142 481 81 865 411 334 935 790 598 912 688 -29 694 37 151 -90 558 108 569 651 342 744 415 622 72 510 934 395 736 440 520 200 571 58 45…
Output: 47

Example 2:

Input: 22 373 904 930 282 -94 735 56 490 754 35 2 636 470 303 273 804 -53 291 204 175 -41 471
Output: 3

Example 3:

Input: 154 4 258 698 301 839 855 611 953 829 923 235 439 569 431 494 -24 25 448 566 -78 114 773 523 87 605 438 -75 699 -9 468 138 118 62 800 901 -43 245 978 40 342 -7 11 805 314 279 829 175 86 731 -6 870 318 748 335 89 356 676 609 462 352 388 864 880 391 315 130 62 143 971 498 493 637 297 927 248 962 34 390 102 695 937 137 -31 365 800 304 827 4 -79 263 784 937 73 253 448 -88 -85 633 796 372 591 552 216 355 435 314 462 444 276 435 416 825 786 449 87 46 560 537 488 259 195 396 997 498 768 775 710 741 420 531 337 658 -53 835 884 9 202 551 159 795 963 210 523 452 919 220 169 974 126 903 51 671 -54 895
Output: 123

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The First Peak Index Beneath Scarlet Plain - EASY Coding Problem | CodeTikki