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

Problem 63: Is There a Pair That Sums to S?

On the first line, integers N and S are given, separated by a half-width space. On the second line, N integers are given. If there exists a combination of two elements at different positions whose sum is exactly S, output Yes; otherwise, output No. Even elements with the same value can form a pair as long as they are at different positions.

Constraints

2 ≤ N ≤ 1000, 0 ≤ S ≤ 2000, 0 ≤ each element ≤ 1000

Input example 1

4 9
2 7 4 5

Output example 1

Yes

Input example 2

3 10
1 2 3

Output example 2

No

What you'll train

Cover the edge cases

What you get

  • Specify how duplicate values are handled
  • Identify boundary cases
  • Give concrete numeric examples

How to ask the AI

Show a concrete numeric example such as N=4, S=9, and clearly tell the AI the rule that "even elements with the same value can be paired as long as they're at different positions." Don't forget to specify the output (No) when no pair is found.

If you ask vaguelyThe AI may mistakenly exclude elements with the same value from being paired together, or may allow an element to be paired with itself.

あなたのコード

実行しました

プレビュー

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

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

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