Next Round (Arrays & Lists)

Scores of n players are listed from highest to lowest. Everyone who scored at least as much as the player in place k goes through, but only with a score above 0. Print how many go through.

Input: n (1 to 50), the n scores (0 to 100, never increasing), then k (1 to n).

Output: One integer.

Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • The cut-off is the score in place k (index k − 1).

More Arrays & Lists practice