日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > php教程 > 158A - Next Round

158A - Next Round

來源:程序員人生   發布時間:2014-12-13 09:19:02 閱讀次數:4155次
A. Next Round
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?≥?ai?+?1).

Output

Output the number of participants who advance to the next round.

Sample test(s)
input
8 5 10 9 8 7 7 7 5 5
output
6
input
4 2 0 0 0 0
output
0
Note

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.

import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int count=0; int[] score = new int[60]; for(int i=0;i<n;i++) score[i]=sc.nextInt(); int max=score[k⑴]; for(int i=0;i<n;i++) if(score[i]>=max&&score[i]>0) count++; System.out.println(count); } }


生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 91超碰在| 国产剧情一区二区三区 | 夜夜爽爽爽久久久久久魔女 | 成年人免费在线观看 | 九九在线免费视频 | 精品三级在线观看 | 中国一级片在线观看 | 99在线视频免费观看 | 黄色一级毛片 | xxxx中国一级片 | 国产视频久久 | 国产精品片在线观看 | 日韩精品在线一区 | 国产成人在线免费观看 | 亚洲视频自拍 | 国产精品一区二区精品视频免费看 | 国产精品美女久久久久aⅴ国产馆 | 国产精品一区二区不卡 | 日韩精品一区二区三区中文字幕 | 欧美性受xxxx黑人xyx | 精品久久久久国产 | 久久6视频 | 久久久久久女乱国产 | 亚洲欧美日本在线 | 一二三区在线 | 黄色av三级| 国产在线二区 | 91网在线 | 狠狠v欧美v日韩v亚洲ⅴ | 国产精品系列在线 | 天天射影院 | 精品美女久久久久久免费 | 国产欧美在线观看 | 91久久精品一区二区二区 | 日本黄xxxxxxxxx100 | 免费成人av在线 | 国产欧美日韩在线观看 | 日本久久免费 | 性色av一区二区三区 | 精品国产91亚洲一区二区三区www | www.色综合 |