Two integers A and B, separated by a half-width space, are given on one line from standard input. Print the difference between A and B. However, make sure the answer is always 0 or greater.
For example, if A is 3 and B is 8, the answer is 5.
Constraints
1 ≤ A, B ≤ 1000
Input example 1
3 8Output example 1
5Input example 2
10 4Output example 2
6What you'll train
State the constraints
What you get
How to ask the AI
Clearly tell the AI the condition that "even if A-B becomes negative, the answer must always be 0 or greater." Rather than leaving it up to the AI whether to use abs or a comparison, spelling out the condition clearly leads to code that matches your intent.
If you ask vaguelyIf you only ask it to "print the difference," the AI may simply compute A-B and print the negative value as-is.
あなたのコード
プレビュー
AIレビュー(プロンプト練習)
コードはChatGPTやClaudeに出させたものを貼って構いません。
ここでの本番は「次にAIへ出す指示」です。評価軸は1つだけ見て、弱点・指示の穴・改善例を返します。
テストに落ちていてもレビューできます。落ちた理由と、指示に足りなかった情報を結びつけます。