#1174. Next Round
Next Round
Next Round
题面翻译
CF158 Next Round 下一轮
题意简述
有个人参加一场比赛,其中分数排名前位的人将被选入下一轮(选入下一轮的人分数必须为正,见样例#2),特别的,如果几个人分数相同且刚好并列处于第名(或是并列名,但是全部算入后选入下一轮的人数超过人),这几个人都将被选入下一轮(见样例#1),题目要求你输出进入下一轮的人数。输入保证已经按分数从大到小排序。
输入输出格式
输入格式
输入一共行: 第行是两个数,分别代表参加比赛的人数和预计将会进入下一轮的人数; 第行有个数,分别参加比赛的人的分数 。(输入保证 )
输出格式
输出一个正整数,即实际进入下一轮的人数。
说明
在样例#1中,第五位和第六位参赛者都获得了七分,所以有六人进入下一轮。 在样例#2中,没有人得到大于0的评分。
翻译提供者:n0000000000o
题目描述
"Contestant who earns a score equal to or greater than the -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 participants took part in the contest ( ), and you already know their scores. Calculate how many participants will advance to the next round.
输入格式
The first line of the input contains two integers and ( ) separated by a single space.
The second line contains space-separated integers ( ), where is the score earned by the participant who got the -th place. The given sequence is non-increasing (that is, for all from to the following condition is fulfilled: ).
输出格式
Output the number of participants who advance to the next round.
样例 #1
样例输入 #1
8 5
10 9 8 7 7 7 5 5
样例输出 #1
6
样例 #2
样例输入 #2
4 2
0 0 0 0
样例输出 #2
0
提示
In the first example the participant on the 5th place earned 7 points. As the participant on the 6th place also earned 7 points, there are 6 advancers.
In the second example nobody got a positive score.