codeforces 158A Next Round (水题)

CarPlay wired(USB)连接方案 CarPlay的wired(USB)的连接方案要求车载设备至少要支持USB2.0 Hi-Speed,支持USB Host Mode,该模式要求车载设备能够工作在USB device模式下,因为Apple设备在CarPlay中是作为USB Host的。而通常情况下,车载设备USB是工作在USB Host模式的,而外接的USB设备是工作在USB Device模式的,因而在这种情况下的CarPlay wired(USB)连接方案中就需要进行USB的模式切换。模式切换完成后便是Apple设备(USB HOST)的枚 阅读详情

题目:

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


Shader Graph入门 Shader Graph 简介 阅读详情

相关推荐

从零开始掌握Python机器学习:七步教程 基础篇

前言 「开始」往往是最难的,尤其是当选择太多的时候,一个人往往很难下定决定做出选择。本教程的目的是帮助几乎没有 Python 机器学习背景的新手成长为知识渊博的实践者,而且这个过程中仅需要使用免费的材料和资源即可。 第一步:基本 Python 技能 如果我们打算利用 Python 来执行机器学习,那么对 Python 有一些基本的了解就是至关重要的。 首先,你需要安装 Python。因为我们后...

hcgx2018的博客 1613

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

CPU进程调度算法【FCFS、SJF、优先级、RR、多级队列、多级反馈队列调度】

目录 一、先到先服务调度: 二、最短作业优先调度: 三、优先级调度: 四、轮转调度: 五、多级队列调度: 六、多级反馈队列调度: CPU调度算法处理的问题是:从就绪队列中选择进程以便为其分配CPU。 一、先到先服务调度: First Come,First Served(FCFS) 定义:先请求CPU的进程首先分配到CPU。FCFS策略可以通过FIFO队列轻松实现。 护航效果:其他所有进程会等待一个大进程释放CPU 非抢占式:一旦CPU分配给了一个进程,该进程就会使用CPU知道释.

马小超 3921

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

ASM磁盘通过rebalance迁移

一、实施要点: 1、数据迁移前,如果库不大,最好全库备份一次 2、进行数据平衡时,数据磁盘是添加到现有磁盘组,而不是重新建一个磁盘组 3、本次实施过程,服务器只有1张HBA卡,本次实施先取消原有的多路径,只保留旧有存储单路径,另一个FC口插上新存储的路径。待迁移完成后,再配置新存储的多路径 二、实施步骤 1.查询并配置ASM磁盘 [root@rac1 ~]# /sbin/scsi_id...

qq_40673916的博客 1373

支付漏洞防护绕过的一种方式

放完包后就到了提交订单的地方,可以发现,金额确实小了很多,合理的搭配的话还可以更低,再次前进可以发现,金额确实是这么多,后面就不支付了,到此就结束了。也就是说数量可以为负数,但是金额不能为0或者0以下,有什么方法可以绕过这个限制吗,其实并不难,既然可以为负数,只是对金额不能为0或者负数做了限制。我们可以尝试拼接法,利用负数加上正数让他的值变得很低,但是又大于0就可以了,这里利用购物车的结算方法,随机加一些在购物车里。这里为了方便查看数据包,我这边商品的数量选择3,点击立即购买并抓包。

2301_80115097的博客 1529

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

解锁RK3588:内核模块签名与安全启动配置全攻略

RK3588作为一款高性能嵌入式SoC芯片,其内核模块签名与安全启动配置是保障系统安全的核心机制。本文详细介绍了RK3588的芯片特性,重点阐述了安全启动的硬件信任链原理和内核模块签名的实现方法。通过具体步骤演示了从密钥生成、模块签名到验证加载的完整流程,并深入解析了安全启动配置的硬件连接、软件工具准备、密钥烧录等关键环节。此外,还提出了防御旁路攻击和动态信任链扩展等高级安全策略,为RK3588在工业控制、智能安防等高安全要求场景中的应用提供了全面的安全解决方案。

远程部署调试 运行安装 项目调试 二次开发 项目技术新 持续迭代 部分源码免费分享 346

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

某智能物流无人值守系统 ExportReport SQL注入漏洞复现

某智能物流无人值守系统 ExportReport存在SQL注入漏洞,未经身份验证的远程攻击者除了可以利用 SQL 注入漏洞获取数据库中的信息(例如,管理员后台密码、站点的用户个人信息)之外,甚至在高权限的情况可向服务器中写入木马,进一步获取服务器系统权限。

0xSec 818

【软考】数据库系统工程师备考指南(一)

目录一、数据库系统工程师简介二、考试要求三、考试目标四、考试范围(一)信息系统知识(二)数据库系统设计与管理 一、数据库系统工程师简介 数据库系统工程师考试属于全国计算机技术与软件专业技术资格(水平)考试(简称计算机软件水平资格考试)中的一个中级考试。考试不设学历与资历条件,也不论年龄和专业,考生可根据自己的技术水平选择合适的级别合适的资格,但一次考试只能报考一种资格。考试采用笔试形式,考试实行全国统一大纲、统一试题、统一时间、统一标准、统一证书的考试办法。笔试安排在一天之内。 2022 年数据库系统工程

邓邓子的博客 3859

codeforces 158A - Next Round (c语言)

158A - Next Round (c语言)

ectfgd的博客 303

探索如何利用CST和ADS进行DDR的SIPI联合仿真

本文系统介绍了CST和ADS两款工具进行DDR信号完整性/电源完整性(SI/PI)联合仿真的方法。CST采用工作室协同方式,通过PCB布局导入、材料设置、模型分配等步骤,重点分析了电源阻抗优化和信号波形质量。ADS则利用SIPro、PIPro等专用工具,突出系统级验证和自动化优化功能。两者各有优势:CST擅长3D结构精确建模,ADS更适于快速系统验证。文章建议可根据项目需求混合使用两种工具,并提供了模型简化、频带选择等实用技巧。通过对比分析,为工程师选择仿真工具提供了决策参考。

一只豌豆象的博客 1150

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

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

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

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

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

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

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、付费专栏及课程。

余额充值