On the first line, integers N and X are given separated by a single space. On the second line, N integers are given separated by single spaces. Output, on one line, how many times X appears among them. If it doesn't appear at all, output 0.
Constraints
1 ≤ N ≤ 100, 0 ≤ X ≤ 1000, 0 ≤ each element ≤ 1000
Input example 1
5 2
1 2 2 3 2Output example 1
3Input example 2
3 9
1 2 3Output example 2
0What you'll train
Cover the edge cases
What you get
How to ask the AI
Tell the AI that if the specified number X doesn't appear anywhere in the sequence, it should output 0. It's also reassuring to clearly convey the input format, where N and X are given on the first line separated by a space.
If you ask vaguelyThe AI may not account for the case where X is not found at all, resulting in code that produces an empty result or an error.
あなたのコード
プレビュー
AIレビュー(プロンプト練習)
コードはChatGPTやClaudeに出させたものを貼って構いません。
ここでの本番は「次にAIへ出す指示」です。評価軸は1つだけ見て、弱点・指示の穴・改善例を返します。
テストに落ちていてもレビューできます。落ちた理由と、指示に足りなかった情報を結びつけます。