小声BB
最近总是状态不好,不管是范围还是特例都有思考不周之处
题干
time limit per test:3 seconds
memory limit per test:256 megabytes
input:standard input
output:standard output
“Contestant who earns a score equal to or greater than the k-th place finisher’s score will advance to the next round, as long as the contestant earns a positive score…” — an excerpt from contest rules.
A total of n participants took part in the contest (n ≥ k), and you already know their scores. Calculate how many participants will advance to the next round.
Input
The first line of the input contains two integers n and k (1 ≤ k ≤ n ≤ 50) separated by a single space.
The second line contains n space-separated integers a1, a2, …, an (0 ≤ ai ≤ 100), where ai is the score earned by the participant who got the i-th place. The given sequence is non-increasing (that is, for all i from 1 to n - 1 the following condition is fulfilled: ai

博客介绍了Codeforces竞赛中关于晋级规则的问题,要求计算得分不低于第k名选手且得分大于0的参赛者数量。题目给出了输入输出格式以及样例,分析部分提醒注意循环条件的设定,避免不必要的复杂性。
最低0.47元/天 解锁文章
772

被折叠的 条评论
为什么被折叠?



