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 (25分)

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

  2. 1117. Eddington Number(25)

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

  3. PAT甲题题解-1117. Eddington Number(25)-(大么个大水题~)

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

  4. PAT 1117 Eddington Number [难]

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

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

    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 (25 分)

    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. 玩转X-CTR100 | STM32F4 l Malloc内存管理

    我造轮子,你造车,创客一起造起来!塔克创新资讯[塔克社区 www.xtark.cn ][塔克博客 www.cnblogs.com/xtark/ ]      内存管理技术,即内存的申请和释放,使用X- ...

  2. html <meta>设置自动刷新或者几秒内跳转到指定页面

    指定时间自动刷新: <meta http-equiv="refresh" content="2"/> 指定时间跳转到指定页面: <meta h ...

  3. 中断一个telnet连接

    假如我要telnet一个端口通不通,测试通过之后后出现黑屏的界面 这时候需要按下ctrl+] 组合键 然后输入 quit 即可退出telnet窗口,可以继续测试下一个端口~

  4. 关于Forsaken Isle

    像素化的饥荒,但是和饥荒比起来,生存压力小了不少. 主要突出的是物品合成上 开始主要采集树枝,须根,岩石,燧石一个须根可以生成一根绳子 挺休闲的,种种菜,合合装备 未来版本会有魔法,潜水,巨龙,土族部 ...

  5. 仿sql注入 sql

    <?phpclass sqlsafe { //(and|or)\\b 表示以and和or结尾的单词如:aand,band,都可以匹配//如果匹配and或or则使用 \\b(and|or)\\b来 ...

  6. Linux更改中国时区

    执行tzselect命令-->选择Asia-->选择China-->选择east China - Beijing, ->然后输入1 再执行 ln -sf /usr/share/ ...

  7. js 压缩 预览 上传图片

    com.js export const compressImage=function (files,fn,preCallbackFn,i) { let newfile = files.files[0] ...

  8. 转:Oracle日期周详解以及周开始结束时间计算

    目录(?)[-] ORACLE中周相关知识描述 日期格式化函数 日期时间运算函数 根据给定时间取一周的开始时间和结束时间 根据给定周数取一周的开始时间和结束时间 获取一年的最大周次 特别应该注意的地方 ...

  9. Ubuntu python-opcua Test

    /********************************************************************************* * Ubuntu python-o ...

  10. linux环境下编译php扩展

    1.使用ext_skel工具生成扩展框架 ./ext_skel --extname=myext 2.编辑config.m4文件 cd myext/vim config.m4 去掉以下内容的注释: PH ...