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 (≤).

Input Specification:

Each input file contains one test case. For each case, the first line gives a positive integer N (≤), 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
 #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n;
int main()
{
cin >> n;
vector<int>v(n);
for (int i = ; i < n; ++i)
cin >> v[i];
sort(v.begin(), v.end());
int k = ;
for (k = ; k < n; ++k)
if (v[k] > n - k)
break;
cout << n - k;
return ;
}

PAT甲级——A1117 Eddington Number【25】的更多相关文章

  1. PAT 甲级 1117 Eddington Number

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

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

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

  3. PAT A1117 Eddington Number (25 分)——数学题

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

  4. A1117. Eddington Number

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

  5. PAT 甲级 1024 Palindromic Number

    1024. Palindromic Number (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A ...

  6. 1117. Eddington Number(25)

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

  7. 【PAT甲级】1070 Mooncake (25 分)(贪心水中水)

    题意: 输入两个正整数N和M(存疑M是否为整数,N<=1000,M<=500)表示月饼的种数和市场对于月饼的最大需求,接着输入N个正整数表示某种月饼的库存,再输入N个正数表示某种月饼库存全 ...

  8. 【PAT甲级】1117 Eddington Number (25分)

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

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

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

随机推荐

  1. 43. 守护线程 和 join方法

    1.守护线程(后台线程):            我们在使用一款软件的时候,有的软件会让我们在不知道的情况下下载一些东西,那么这个就是后台线程.            一般用于提高软件的下载量(也就是 ...

  2. Batch - 忽略FORFILES “no files found” error

    ref:https://stackoverflow.com/questions/16820681/suppress-forfiles-no-files-found-error Solution: Th ...

  3. Servlet - Servlet相关

    1. 概念 Servlet是指任何实现了Servlet接口的类, Servlet运行于支持Java的应用服务器中, Servlet可以响应任何类型的请求, 但大多数情况下, Servlet只用来扩展基 ...

  4. is与==的区别

    is:比较两边的内存地址是否一样 ==:比较两边的数据值是否一样 list1 = [1, 2] list2 = [1, 2] if list1 == list2: # == 是比较数据 print(' ...

  5. Android NDK 环境变量配置

    NDK_ROOT = C:\__S_D_K__\AndroidNDK\android-ndk-r20 在path 中加入  %NDK_ROOT% 我的路径在C盘 //个别的程序可能需要 NDK_ROO ...

  6. 关于windows下远程连接Linux服务器的方法(CentOs)

    1.服务器端安装VNC 1) 安装vncserver yum install -y tigervnc-server 2) 修改配置 vi /etc/sysconfig/vncservers   最后两 ...

  7. delphi 获取所有窗口标题

    unit Unit1; interface usesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, ...

  8. NX二次开发-UFUN输入表达式名称,获取它的名称和值UF_MODL_ask_exp

    NX9+VS2012 #include <uf.h> #include <uf_modl.h> UF_initialize(); //创建一个新的表达式,有TAG tag_t ...

  9. NX二次开发-创建旋转UF_MODL_create_revolved

    NX9+VS2012 #include <uf.h> #include <uf_curve.h> #include <uf_modl.h> UF_initializ ...

  10. NXOpenC#_Training_2(cn)【转载】