【链接】 我是链接,点我呀:)

【题意】

让你找到排名的前k名,并列的话,如果分数大于0那么就算晋级
问你最后有多少人可以晋级.

【题解】

按照题意模拟就好,
先按照a[max] = a[k]的规则找到下标的最大值max
然后依据a[max]==0的规则,一直减小这个max.
直到max变成0为止。
最后输出max就好了

【代码】

import java.util.Scanner;

public class Main {

	public static int N = 50;

	public static int n,k;
public static int a[]; public static void main(String[] args) {
Scanner in = new Scanner(System.in);
a = new int[N+10]; n = in.nextInt();k = in.nextInt();
for (int i = 1;i <= n;i++) a[i]= in.nextInt();
int ma = k;
for (int i = k+1;i <= n;i++)
if (a[i]==a[k]) {
ma = i;
}
while (a[ma]==0 && ma>=1) ma--;
System.out.println(ma);
}
}

【Codeforces 158A】Next Round的更多相关文章

  1. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  2. 【51.27%】【codeforces 604A】Uncowed Forces

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  3. 【codeforces 742C】Arpa's loud Owf and Mehrdad's evil plan

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  4. 【codeforces 546D】Soldier and Number Game

    time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  5. 【codeforces 750B】New Year and North Pole

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  6. 【codeforces 766D】Mahmoud and a Dictionary

    time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  7. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

  8. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  9. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

随机推荐

  1. java使用poi读取doc和docx文件(maven自动导入依赖包)

    java使用poi读取doc和docx文件(maven自动导入依赖包) 于是在网上搜寻了一阵之后才发现原来doc文档和excel一样不能用普通的io流的方法来读取,而是也需要用poi,于是进行了一番尝 ...

  2. Silverlight 2学习笔记二:三个基本布局控件(Canvas、StackPanel、Grid )

    这篇文章主要是翻译了ScottGu博客的文章:Silverlight Tutorial Part 2: Using Layout Management.虽然是翻译,但通过笔记记录,我发现对这三个布局控 ...

  3. bzoj4561

    扫描线 想法挺妙 搞了很长很长时间... http://www.cppblog.com/superlong/archive/2010/08/06/122427.html #include<bit ...

  4. MySQL社区版是世界上最流行的开源数据库的免费

    昨天晚上搞了很久,终于搞清楚mysql的安装配置了,我真是太low了.当我在云服务器上登进Mysql时,真是高兴哈哈,咱一步一步来,彻底搞懂Mysql的安装配置. 我的安装环境: 阿里云服务器 1 2 ...

  5. mysql_mssql_access_2017年最新手机号段归属地数据库(17年4月更新)360569记录

    mysql,mssql,access 三种格式免费分享给大家,末尾有下载地址 2017年4月最新版手机号段归属地,也叫手机归属地数据库  共360569条记录,三种格式:MYSQL,MSSQL,acc ...

  6. Akka源码分析-Remote-发消息

    上一篇博客我们介绍了remote模式下Actor的创建,其实与local的创建并没有太大区别,一般情况下还是使用LocalActorRef创建了Actor.那么发消息是否意味着也是相同的呢? 既然ac ...

  7. An problem about date 根据年月日计算 星期几

    /W = (d+2*m+3*(m+1)/5+y+y/4-y/100+y/400) mod 7(1.2月需要看作上一年的13.14月) #include<stdio.h> #include& ...

  8. 【知识总结】多项式全家桶(一)(NTT、加减乘除和求逆)

    我这种数学一窍不通的菜鸡终于开始学多项式全家桶了-- 必须要会的前置技能:FFT(不会?戳我:[知识总结]快速傅里叶变换(FFT)) 以下无特殊说明的情况下,多项式的长度指多项式最高次项的次数加\(1 ...

  9. ACM_梦中的函数

    梦中的函数 Time Limit: 2000/1000ms (Java/Others) Problem Description: 寒假那段时间,每天刷题的小G连做梦都是代码,于是有了这道题. 给定一个 ...

  10. 322 Coin Change 零钱兑换

    给定不同面额的硬币(coins)和一个总金额(amount).写一个函数来计算可以凑成总金额所需的最少的硬币个数.如果没有任何一种硬币组合方式能组成总金额,返回-1.示例 1:coins = [1, ...