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;
}

CodeForces.158A Next Round (水模拟)的更多相关文章

  1. CodeForces.71A Way Too Long Words (水模拟)

    CodeForces71A. Way Too Long Words (水模拟) 题意分析 题怎么说你怎么做 没有坑点 代码总览 #include <iostream> #include & ...

  2. HDU 5908 Abelian Period (BestCoder Round #88 模拟+暴力)

    HDU 5908 Abelian Period (BestCoder Round #88 模拟+暴力) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=59 ...

  3. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) A B C D 水 模拟 构造

    A. Neverending competitions time limit per test 2 seconds memory limit per test 512 megabytes input ...

  4. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) A B C D 水 模拟 二分 贪心

    A. Is it rated? time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  5. Codeforces Round #301 (Div. 2)A B C D 水 模拟 bfs 概率dp

    A. Combination Lock time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  6. Codeforces Round #375 (Div. 2) A B C 水 模拟 贪心

    A. The New Year: Meeting Friends time limit per test 1 second memory limit per test 256 megabytes in ...

  7. Codeforces Round #374 (Div. 2) A B C D 水 模拟 dp+dfs 优先队列

    A. One-dimensional Japanese Crossword time limit per test 1 second memory limit per test 256 megabyt ...

  8. Codeforces Round #277 (Div. 2) A B C 水 模拟 贪心

    A. Calculating Function time limit per test 1 second memory limit per test 256 megabytes input stand ...

  9. Codeforces Round #392 (Div. 2) A B C 水 模拟 暴力

    A. Holiday Of Equality time limit per test 1 second memory limit per test 256 megabytes input standa ...

随机推荐

  1. PS 证件照换颜色

    1.打开要修改的图片,然后先Ctrl+J备份一份 2.点击魔法棒,点击要换颜色的地方,如衣服,之后会出现虚线,如果自动选择的不全,可以按住Shift键自行选择区域 3.然后Shift+Fn+F5(由于 ...

  2. thinkphp5保存远程图片到本地

    代码 protected function saveImg($imgUrl){ $ext=strrchr($imgUrl,'.'); if(!in_array($ext,['.jpg','.png', ...

  3. linux基础——文件挂载,lamp安装

    一. 文件挂载 lsblk -f 显示文件系统信息 mount -t vfat UUID="ffffffffff" /mnt   挂载到/mnt目录 Linux针对于各式U盘挂载方 ...

  4. 流畅的python(笔记)

    流畅的python中有很多奇技淫巧,整本书都在强调如何最大限度地利用Python 标准库.介绍了很多python的不常用的数据类型.操作.库等,对于入门python后想要提升对python的认识应该有 ...

  5. Visual Studio Code——PHP Debug扩展

    最近在使用PHP开发,使用了很多IDE,发现都不是很顺手,之前一直都在使用Sublime Text,但是作为一个爱折腾的人,当我发现VS Code以后觉得很是很适合自己的编程需要的.配置过程中遇到了一 ...

  6. stm32之SPI通信协议

    SPI (Serial Peripheral interface),顾名思义就是串行外围设备接口.SPI是一种高速的,全双工,同步的通信总线,并且在芯片的管脚上只占用四根线,节约了芯片的管脚,同时为P ...

  7. python3-声音处理

    先来说下二进制读写文件,这需要struct库 #二进制文件读写 import struct a= b=- # print(struct.pack("h",b)) # print(s ...

  8. java基础-Comparator接口与Collections实现排序算法

    java 排序Comparable和Comparator使用 java提供了两个排序用的接口Comparable和Comparator,一般情况下使用区别如下: Comparable 接口用于类的固定 ...

  9. Vuejs 实现简易 todoList 功能 与 组件

    todoList 结合之前 Vuejs 基础与语法 使用 v-model 双向绑定 input 输入内容与数据 data 使用 @click 和 methods 关联事件 使用 v-for 进行数据循 ...

  10. JavaScriptSerializer的实现-常用JsonHelper类

    最近开始自己写自己的项目了,终于鼓起勇气迈出了自己认为的这一大步! 先来通用的helper类和大家分享一下 ,第一个是Object转为json序列的类,这个网上有很多,但我实践了一下大部分都不能用的, ...