1117 Eddington Number (25 分)

时间:2022-05-30 21:17:23
1117 Eddington Number (25 分)

British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- that is, the maximum integer E such that it is for E days that one rides more than E miles. Eddington's own E was 87.

Now given everyday's distances that one rides for N days, you are supposed to find the corresponding E (≤N).

Input Specification:

Each input file contains one test case. For each case, the first line gives a positive integer N (≤10​^5​​), the days of continuous riding. Then N non-negative integers are given in the next line, being the riding distances of everyday.

Output Specification:

For each case, print in a line the Eddington number for these N days.

Sample Input:

10
6 7 6 9 3 10 8 2 7 8

Sample Output:

6

分析:水题,先排序
 /**
 * Copyright(c)
 * All rights reserved.
 * Author : Mered1th
 * Date : 2019-02-27-19.43.40
 * Description : A1117
 */
 #include<cstdio>
 #include<cstring>
 #include<iostream>
 #include<cmath>
 #include<algorithm>
 #include<string>
 #include<unordered_set>
 #include<map>
 #include<vector>
 #include<set>
 using namespace std;
 ;
 int a[maxn];
 bool cmp(int a,int b){
     return a>b;
 }
 int main(){
 #ifdef ONLINE_JUDGE
 #else
     freopen("1.txt", "r", stdin);
 #endif
     int n,i;
     scanf("%d",&n);
     ;i<=n;i++){
         scanf("%d",&a[i]);
     }
     sort(a+,a+n+,cmp);
     ;i<=n;i++){
         if(a[i]<=i) break;
     }
     cout<<i-;
     ;
 }
 

1117 Eddington Number (25 分)的更多相关文章

  1. 【PAT甲级】1117 Eddington Number &lpar;25分&rpar;

    题意: 输入一个正整数N(<=100000),接着输入N个非负整数.输出最大的整数E使得有至少E个整数大于E. AAAAAccepted code: #define HAVE_STRUCT_TI ...

  2. 1117&period; Eddington Number&lpar;25&rpar;

    British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, h ...

  3. PAT甲题题解-1117&period; Eddington Number&lpar;25&rpar;-(大么个大水题~)

    如题,大水题...贴个代码完事,就这么任性~~ #include <iostream> #include <cstdio> #include <algorithm> ...

  4. PAT 1117 Eddington Number &lbrack;难&rsqb;

    1117 Eddington Number (25 分) British astronomer Eddington liked to ride a bike. It is said that in o ...

  5. PAT 甲级 1024 Palindromic Number &lpar;25 分&rpar;(大数加法,考虑这个数一开始是不是回文串)

    1024 Palindromic Number (25 分)   A number that will be the same when it is written forwards or backw ...

  6. PAT 甲级 1117 Eddington Number

    https://pintia.cn/problem-sets/994805342720868352/problems/994805354762715136 British astronomer Edd ...

  7. PAT 1117 Eddington Number

    British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, h ...

  8. 1024 Palindromic Number &lpar;25 分&rpar;

    A number that will be the same when it is written forwards or backwards is known as a Palindromic Nu ...

  9. 1117 Eddington Number

    题意:给出了N个数字,确定一个尽可能大的数字E,要求这N个数字中大于E的数字有E个. 思路: 乍一看不知道题目在说啥.静下心来多读几遍题目,在草稿纸上比划比划,发现是个大水题.解释一下样例,原始序列为 ...

随机推荐

  1. 向modesim中添加alter库 (或者在每次仿真时将库文件加入仿真文件夹一起编译)

    在ModelSim中进行仿真需要加入Quartus提供的仿真库,原因是下面三个方面:    ·Quartus不支持Testbench:    ·调用了megafunction或者lpm库之类的Alte ...

  2. Git工作流总结

    引用自:https://github.com/xirong/my-git/blob/master/git-workflow-tutorial.md 说明: 个人在学习Git工作流的过程中,从原有的 S ...

  3. Xcode中文乱码问题

    老师给拷贝的程序用Xcode打开中文显示是乱码,而预览里面是正常显示的,Xcode默认编码UTF-8没错的,怎么办呢? 解决办法:用自带的文本编辑器打开,全选,复制,Xcode中打开文件,粘贴,ok~ ...

  4. Nginx&plus;Tomcat的服务器端环境配置详解

    这篇文章主要介绍了Nginx+Tomcat的服务器端环境配置详解,包括Nginx与Tomcat的监控开启方法,需要的朋友可以参考下 Nginx+tomcat是目前主流的Javaweb架构,如何让ngi ...

  5. Android 之 MediaPlayer类

    在Android中通常用MediaPlayer来播放一些媒体文件,对于音频文件来说只需直接使用MeidaPlayer结合几句代码即可,但是对于视频文件来说稍微复杂一些.单独的MediaPlayer只能 ...

  6. yum安装man命令程序错误

    第一次安装CentOS后,man命令无法使用,查了一下,发现没有安装man命令程序.尝试安装man yum install man 结果如下: Loaded plugins: fastestmirro ...

  7. 从零开始学python

    自从20世纪90年代初Python语言诞生至今,它已被广泛应用于系统管理任务的处理和Web编程.今天就来给大家看看学Python的五大优势吧! NO.1 全球三大主流编程语言之一 python是一种面 ...

  8. 网站 Cookie only 唯一 防止被截获

    void Page_Load(object sender, EventArgs e) { // Create a new HttpCookie. HttpCookie myHttpCookie = n ...

  9. PHP全路径无限分类原理

    全路径无限分类:以一个字段把他所有的父级id按顺序记录下来以此实现的无限分类叫做全路径无限分类 优点:查询方便 缺点:增加,移动分类时数据维护时稍微复杂.

  10. bzoj 1086&colon; &lbrack;SCOI2005&rsqb;王室联邦 &lpar;分块&plus;dfs)

    Description “余”人国的国王想重新编制他的国家.他想把他的国家划分成若干个省,每个省都由他们王室联邦的一个成员来管理.他的国家有n个城市,编号为1..n.一些城市之间有道路相连,任意两个不 ...