CodeDrill
day_streak: --
← 問題一覧に戻る
Python ・ Standard I/O

Problem 16: Position of the Maximum Value

You are given an integer N on the first line, and N integers separated by single spaces on the second line. Output, on one line, the position at which the largest value appears, counting the first element as position 1.

If there are multiple occurrences of the maximum value, answer with the position of the earliest one.

Constraints

1 ≤ N ≤ 100, 0 ≤ each element ≤ 1000

Input example 1

5
3 1 4 1 5

Output example 1

5

Input example 2

3
10 2 7

Output example 2

1

What you'll train

Cover the edge cases

What you get

  • Specify how to handle ties
  • Explain how positions are counted
  • State the input range

How to ask the AI

Clearly convey which one to answer with when there are multiple occurrences of the maximum value (the earliest one), and specify that positions are counted starting from 1.

If you ask vaguelyIf there are multiple occurrences of the maximum value, the AI might answer with the index of the last one found.

あなたのコード

実行しました

プレビュー

AIレビュー(プロンプト練習)

コードはChatGPTやClaudeに出させたものを貼って構いません。
ここでの本番は「次にAIへ出す指示」です。評価軸は1つだけ見て、弱点・指示の穴・改善例を返します。
テストに落ちていてもレビューできます。落ちた理由と、指示に足りなかった情報を結びつけます。

先にコードを実行し、テストを1つ以上通してください。