Problems
Status
Contests
Events
Standings
Topic
IDE Online
Login
Description
Editorial
My Submission
1061.Advance Next Round
Look up all submission
Status
Time
Memory
Lang.
Submit Date
1061.Advance Next Round
Time Limit:1000MS Memory Limit:65535KB
Description
有一个比赛,晋级下一轮的规则是:"参赛者如果得分大于0且不小于排名第K的参赛者的得分,将晋级下一轮!" 现在已知有n名参赛者(n≥k),以及他们各自的得分,现在你需要计算将有多少人晋级下一轮。
Input
输入的第一行包含两个整数n和k(1≤k≤n≤50),一空格分开。 第二行包含n个用空格分开的整数A~i~(0≤A~i~≤100),表示排名第i的参赛者的得分。其中对任意的i满足A~i~≥A~i+1~。
Output
输出将有多少人晋级下一轮。
Sample test
Sample input
5 1 1 1 1 1 1
Sample output
5
Note
更多样例及解释: input 8 5 10 9 8 7 7 7 5 5 output 6 参赛者第5名得分是7,然而第6名也是7,则有6人晋级 input 4 2 0 0 0 0 output 0 没有人得分,所以没人晋级
Tags
implementation
Post editorial
Editorials
GNU C++ 9.3.0
GNU C 9.3.0
Java 1.8
Python 3.8.4
Lua 5.3
GO 1.12.4
JS - (nodejs 10.19.0)
Login before submit
Test Input
Test Output
5 1 1 1 1 1 1
Please run you code firstly.
Console
IDE Setting
字体设置
调整适合你的字体大小。
12px
13px
14px
15px
16px
18px
20px
主题设置
切换不同的代码编辑器主题,选择适合你的语法高亮。
Visual Studio
Visual Studio Dark
High Contrast Dark
行宽限制
设置每一行代码的最大字符个数,设置为0则不限制。
0
80
100
120