cswork / OA打开练习工作台

AdobeOA #2

Count Players Eligible to Level Up

估计简单可在线判题

考点(AI 标注)原地数组

Players with equal scores share the same rank, and a player's rank is 1 plus the number of players with a strictly higher score. Only players whose rank is ≤k and whose score is not 0 are promoted.

输入格式

The first line contains n k, and the second line contains n scores. The original bounds are 1≤n≤100000, 0≤score≤100, and k≤n with no lower bound; this site adds −10^9≤k≤n, and no one is promoted when k≤0.

输出格式

Output a single integer answer.

样例 1

输入:

4 3
100 50 50 25

输出:

3

样例 2

输入:

2 2
0 0

输出:

0

样例 3

输入:

3 1
100 100 10

输出:

2

样例说明

The original example promotes 3 players. The other two examples give 0 and 2 respectively. The sample code in the original summary chapter does not exclude scores of 0 and must not be reused.