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

Problem 28: Count of Values at or Above a Threshold

Integers N and K, separated by a half-width space, are given on the first line. N integers separated by half-width spaces are given on the second line. Print, on one line, how many of them are K or greater.

For example, with N=5, K=3 and the sequence 1 2 3 4 5, there are 3 values that are 3 or greater (3, 4, 5), so print 3.

Constraints

1 ≤ N ≤ 100, 0 ≤ K ≤ 1000, 0 ≤ each element ≤ 1000

Input example 1

5 3
1 2 3 4 5

Output example 1

3

Input example 2

3 10
1 2 3

Output example 2

0

What you'll train

State the constraints

What you get

  • Write how to handle boundary values
  • Distinguish between at-least and greater-than
  • Make the equality in the condition explicit

How to ask the AI

Clearly tell the AI that the condition "K or greater" includes K itself. This is easily confused with "greater than K," so giving a concrete example (if K=3, then 3 is included) helps prevent misunderstanding.

If you ask vaguelyMisinterpreting "K or greater" as "greater than K" may cause the AI to write code that forgets to count the boundary value equal to K.

あなたのコード

実行しました

プレビュー

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

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

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