Two integers A and B are given on one line, separated by a single space. Output the greatest common divisor of A and B on one line.
Constraints
1 ≤ A, B ≤ 1000000
Input example 1
12 18Output example 1
6Input example 2
7 5Output example 2
1What you'll train
Communicate the purpose
What you get
How to ask the AI
Clearly state that what you want is the greatest common divisor, and it's a good idea to also specify the implementation approach, such as using math.gcd or the Euclidean algorithm.
If you ask vaguelyIf the goal is left ambiguous, the AI may end up writing code that calculates the least common multiple instead of the greatest common divisor.
あなたのコード
プレビュー
AIレビュー(プロンプト練習)
コードはChatGPTやClaudeに出させたものを貼って構いません。
ここでの本番は「次にAIへ出す指示」です。評価軸は1つだけ見て、弱点・指示の穴・改善例を返します。
テストに落ちていてもレビューできます。落ちた理由と、指示に足りなかった情報を結びつけます。