codeforces 158A Next Round (水题)

嵌入式开发必看:STM32 DMA双缓冲配置全攻略(含CubeMX教程) 本文详细解析了STM32 DMA双缓冲机制的原理与优势,并提供了基于CubeMX的完整配置教程。通过硬件自动切换两个缓冲区,实现DMA传输与CPU处理的真正并行,有效降低中断频率,提升高速数据采集、音频流处理等场景下的系统效率和实时性。 阅读详情

题目:

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.

题意分析:

有n个数字,计算大于等于第k个数的个数。水题,不解释


代码:

#include<iostream>
int n,k,i,j,a[51];
using namespace std;
int main()
{
    cin>>n>>k;
    while(n>i)  cin>>a[i++];
    while(a[j]&&a[j]>=a[k-1])++j;
    cout<<j;
}


别再死记硬背了!用‘小乌龟’实战图解ROS1核心指令(rosnode/rostopic/rosparam保姆级手册) 本文通过经典的turtlesim乌龟仿真器,以可视化实战方式讲解ROS1核心指令(rosnode/rostopic/rosparam),帮助初学者摆脱死记硬背,在操控乌龟的过程中轻松掌握节点管理、话题通信和参数设置等ROS1核心概念。 阅读详情

相关推荐

Verilog的综合指令

Synopsys综合指令

烟花一时的博客 5447

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

无知的我 2845

第1章>>1.5:神电测控为什么开发LabVIEW ZYNQ FPGA软件工具包?(ZYNQ芯片的特点与优势)《LabVIEW ZYNQ FPGA宝典》

ZYNQ是赛灵思公司(Xilinx)推出的新一代全可编程片上系统(APSoC,All-Programmable SoC),它将处理器的软件可编程性与FPGA的硬件可编程性进行完美整合,以提供无与伦比的系统性能、灵活性与可扩展性。Zynq-7000系列是Xilinx于2010年4月推出的行业第一个可扩展处理平台,旨在为视频监视、汽车驾驶员辅助、工厂自动化、医疗器械等高端嵌入式应用提供所需的处理能力与计算性能。这款基于ARM处理器的SoC可满足复杂嵌入式系统的高性能、低功耗和多核处理能力等要求。

qq_40694786的博客 1646

158A - Next Round

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

Cai_Haiq的博客 743

maya中的几个热盒(空格、shift、w键)

maya中许多功能打包放进了不同的热盒中,让我们使用起来更加的便捷,熟练掌握后可以大大提升了建模速度。按下不同按键后鼠标不需要精确点到某个图标,往某个方向滑滑滑就打开了相应功能,非常的炫酷和迅猛。

m0_71983242的博客 1756

【无机纳米材料科研制图——OriginLab 0205】Origin对BET吸附/脱附曲线及孔径分布制图...

此篇,我们来分享如何对BET数据进行处理和制图。 一、等温吸脱附曲线绘制 1)找到等温吸脱附文件。 一半来说,对一个样品测一次BET,会产生很多数据,具体因仪器而异。我这里的数据主要有两个文件夹,一个脱附,一个吸附,吸附文件夹中多了一个等温吸脱附的文件夹。而这...

XD_Yangf的博客 803

A. Next Round【难度: 水题 / 知识点: 模拟】

https://codeforces.com/problemset/problem/158/A #include<bits/stdc++.h> using namespace std; const int N=1e5+10; int n,m,cnt,s[N]; int main(void) { cin>>n>>m; for(int i=1;i<=n;i++) cin>>s[i]; int temp=s[m]; for(int i=1;i<.

bettle_king的博客 239

解决SolidWorks启动报错问题:SolidWorks2020显示无法获得下列许可 SolidWorks standard 期望的SolidWorks监控程序已经关闭(-97,121,0)

解决SolidWorks启动报错问题:SolidWorks2020显示无法获得下列许可 SolidWorks standard 期望的SolidWorks监控程序已经关闭(-97,121,0) 问题描述 打开SolidWorks2020时,显示SolidWorks2020显示无法获得下列许可 SolidWorks standard 期望的SolidWorks监控程序已经关闭(-97,121,0) (急需看模型的我心里万马奔腾…) 截图如下: 有问题咱就上 看了其他博主的回答,自己尝试了几个,发现出现了新的

qq_44606358的博客 7万+

VK Cup 2012 Qualification Round 1 A题

这题要仔细阅读题目的意思!就是这就句话“"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 e

傻笨 961

【ComfyUI专栏】安装Triton组件

Triton是一款支持大模型推理的深度学习加速组件,最初仅支持Linux平台,现已通过开源社区适配Windows系统。针对SageAttention的安装,建议使用3.2.0Post10版本(该版本提供封装好的安装包,更高版本仅有源码)。用户可通过GitHub获取安装资源,或直接使用pip命令"pip install triton-windows"进行安装。安装时需注意:1)在虚拟环境中操作;2)使用管理员权限。相关资源链接已在文中提供。

技术与管理的平衡木- 1861

RuoYi-Cloud-Plus使用minio进行文件上传图片后无法预览解决_修改minio配置minio桶权限---SpringCloud工作笔记198

在文件管理的位置,发现刚刚上传的图片文件,会显示 预览图片失败 后来经过多方查看,发现是minio的配置的问题。可以看到首先登录RuoYi-Cloud-Plus系统然后,打开文件管理页面可以看到,当上传了图片文件以后。登录以后,选中左侧Buckets,可以看到有自己用的桶,找到以后点击打开。显示文件展示中,文件预览失败,那么这个时候,去修改minio的配置。可以看到,点击配置管理,这里我们启用的是minio对吧。默认是没有配置的这个时候,是允许下载,但不允许预览的.

添柴程序猿的专栏 5567

codeforces 158A - Next Round (c语言)

158A - Next Round (c语言)

ectfgd的博客 303

SSE 传输过程中,丢失空格和回车符,怎么解决?

Server - Sent Events(SSE)即服务器发送事件,是 HTML5 中的一项 Web API,用于实现服务器向客户端浏览器推送实时数据的功能。

934

codeforces 158A Next Round(水题)

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

1460

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Codeforces——158A Next Round

小声BB 最近总是状态不好,不管是范围还是特例都有思考不周之处 题干 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

真田伊廉的博客 531

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Next Round_Codeforces_158A

原题链接:http://codeforces.com/problemset/problem/158/A A. Next Round time limit per test 3 seconds memory limit per test 256 megabytes input standard input output s

MoogleAndChocobo的博客 229

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

codeforces 158A Next Round

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

煌的博客 335

【Codeforces 158A】Next Round

【链接】 我是链接,点我呀:) 【题意】 让你找到排名的前k名,并列的话,如果分数大于0那么就算晋级 问你最后有多少人可以晋级. 【题解】 按照题意模拟就好, 先按照a[max] = a[k]的规则找到下标的最大值max 然后依据a[max]==0的规则,一直减小这个max. 直到max变成0为止。 最后输出max就好了 【代码】 import java.util.S...

239

CodeForces.158A Next Round (水模拟)

CodeForces.158A Next Round (水模拟)题意分析校赛水题的英文版,坑点就是要求为正数。代码总览#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <sstream> #include <set> #include <map> #include <queue

Pengwill's Blog 329

Codeforces 158A Next Round

题目链接 http://codeforces.com/problemset/problem/158/A #include<iostream> #include<string> using namespace std; int main() { int n,k; int num=0; int arr[100]={0}; ...

weixin_30532369的博客 151

Codeforces Problem-158A Next Round

Codeforces Problem-158A Next Round 基本思想: 考虑到本题数据样本并不大,可以暴力直接求解。 计数条件:a[i]≠0且a[i]≥a[k-1]。//(从0开始计数) AC代码: #include <bits/stdc++.h> using namespace std; int main() { int n,k; int a[105]; memset(a,0,sizeof(a)); scanf("%d%d",&n,&k); for

BrilliantWilliam的博客 240

Problem——158A. Next Round——Codeforces

time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output “Contestant who earns a score equal to or greater than the k-th place finisher’s score will ad...

Foolishman的博客 334

Codeforces 158A - Next Round

问题: 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 plac...

Yuhan的博客 283

Codeforces 158A-Next Round

思路:得分非正数直接跳过,因为序列是非增的,所以第k个数及之前的正数直接计算在内,第k个数之后的与第k个数相等的可计算在内。positive 正数的 excerpt 节选 non-increasing 非增。

ywzdcj的博客 198

codeforce158A Next Round

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 gre

保险柜 315
上一篇: Codeforces Round #109 (Div. 2) B (贪心)
下一篇: codeforces 158B Taxi (贪心)
Notdeep__acm
博客等级 码龄12年 20粉丝 53原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值