CodeForces.158A Next Round (水模拟)
2024-09-04 16:32:24
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;
}
最新文章
- mpi4py实践
- window.showModalDialog的简单实践
- poj1308(简单并查集)
- openstack 流量控制
- C#垃圾回收机制(GC)
- 今天遇到的mouseout和mouseleave之坑
- 关于myeclipse中导入的项目修改项目名使得发布到tomcat访问路径正确
- codility上的练习(3)
- SharePoint Server 2010 删除Web应用
- java_XML_Dom4j
- python d:\test.py File ";<;stdin>;";, line 1 python d:\test.py ^ SyntaxError: invalid syntax
- oracle 时间日期常用语句及函数
- 【PostgresSQL】同时更新两个表
- 查看电脑的IP地址及配置
- dubbo-admin 无法支持JDK1.8
- PHP对redis操作详解
- openstack nova 深入
- html,css,javascript角色划分
- chrome浏览器Network面板请求Timing分析
- Shell基础学习(二) Shell变量
热门文章
- 「日常训练」Brackets in Implications(Codeforces Round 306 Div.2 E)
- Linux命令应用大词典-第21章 LVM和RAID管理
- C# 中访问修饰符
- ionic 日期插件学习
- Elasticsearch 评分score计算中的Boost 和 queryNorm
- Fluent Python: Classmethod vs Staticmethod
- PCB各层介绍及AD软件画PCB时的规则
- Thunder团队第六周 - Scrum会议5
- NIO 服务端TCP连接管理的方案
- 由作业题引发对C++引用的一些思考