我是靠谱客的博主 激动含羞草,这篇文章主要介绍CodeForces.158A Next Round (水模拟),现在分享给大家,希望可以做个参考。

CodeForces.158A Next Round (水模拟)

题意分析

校赛水题的英文版,坑点就是要求为正数。

代码总览

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <sstream> #include <set> #include <map> #include <queue> #include <stack> #include <cmath> #define INF 0x3f3f3f3f #define nmax 200 #define MEM(x) memset(x,0,sizeof(x)) using namespace std; int a[nmax]; int main() { //freopen("in.txt","r",stdin); int n,k; while(scanf("%d %d",&n,&k)!= EOF){ for(int i = 0; i<n;++i) scanf("%d",&a[i]); int tar = a[k-1]; int ans = 0; for(int i = 0;i<n;++i){ if(a[i] <=0) break; if(a[i] < tar) break; if(a[i] >= tar) ans++; } printf("%dn",ans); } return 0; }

最后

以上就是激动含羞草最近收集整理的关于CodeForces.158A Next Round (水模拟)的全部内容,更多相关CodeForces.158A内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(62)

评论列表共有 0 条评论

立即
投稿
返回
顶部