CodeForces.158A Next Round (水模拟)

题意分析

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

代码总览

#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("%d\n",ans);
}
return 0;
}

最新文章

  1. mpi4py实践
  2. window.showModalDialog的简单实践
  3. poj1308(简单并查集)
  4. openstack 流量控制
  5. C#垃圾回收机制(GC)
  6. 今天遇到的mouseout和mouseleave之坑
  7. 关于myeclipse中导入的项目修改项目名使得发布到tomcat访问路径正确
  8. codility上的练习(3)
  9. SharePoint Server 2010 删除Web应用
  10. java_XML_Dom4j
  11. python d:\test.py File &quot;&lt;stdin&gt;&quot;, line 1 python d:\test.py ^ SyntaxError: invalid syntax
  12. oracle 时间日期常用语句及函数
  13. 【PostgresSQL】同时更新两个表
  14. 查看电脑的IP地址及配置
  15. dubbo-admin 无法支持JDK1.8
  16. PHP对redis操作详解
  17. openstack nova 深入
  18. html,css,javascript角色划分
  19. chrome浏览器Network面板请求Timing分析
  20. Shell基础学习(二) Shell变量

热门文章

  1. 「日常训练」Brackets in Implications(Codeforces Round 306 Div.2 E)
  2. Linux命令应用大词典-第21章 LVM和RAID管理
  3. C# 中访问修饰符
  4. ionic 日期插件学习
  5. Elasticsearch 评分score计算中的Boost 和 queryNorm
  6. Fluent Python: Classmethod vs Staticmethod
  7. PCB各层介绍及AD软件画PCB时的规则
  8. Thunder团队第六周 - Scrum会议5
  9. NIO 服务端TCP连接管理的方案
  10. 由作业题引发对C++引用的一些思考