An integer N is given on one line from standard input. Output the sum of the integers from 1 to N.
Constraints
1 ≤ N ≤ 100000
Input example 1
5Output example 1
15Input example 2
1Output example 2
1What you'll train
Cover the edge cases
What you get
How to ask the AI
Tell the AI that when N=1, only 1 should be output, and that it should use a method (a loop or a formula) that computes the correct result even when N is very large.
If you ask vaguelyIf you don't convey the boundary values, the AI might overlook the case where N=1 and output 0 or an incorrect sum.
あなたのコード
プレビュー
AIレビュー(プロンプト練習)
コードはChatGPTやClaudeに出させたものを貼って構いません。
ここでの本番は「次にAIへ出す指示」です。評価軸は1つだけ見て、弱点・指示の穴・改善例を返します。
テストに落ちていてもレビューできます。落ちた理由と、指示に足りなかった情報を結びつけます。