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 分)的更多相关文章
- 【PAT甲级】1117 Eddington Number (25分)
题意: 输入一个正整数N(<=100000),接着输入N个非负整数.输出最大的整数E使得有至少E个整数大于E. AAAAAccepted code: #define HAVE_STRUCT_TI ...
- 1117. Eddington Number(25)
British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, h ...
- PAT甲题题解-1117. Eddington Number(25)-(大么个大水题~)
如题,大水题...贴个代码完事,就这么任性~~ #include <iostream> #include <cstdio> #include <algorithm> ...
- PAT 1117 Eddington Number [难]
1117 Eddington Number (25 分) British astronomer Eddington liked to ride a bike. It is said that in o ...
- PAT 甲级 1024 Palindromic Number (25 分)(大数加法,考虑这个数一开始是不是回文串)
1024 Palindromic Number (25 分) A number that will be the same when it is written forwards or backw ...
- PAT 甲级 1117 Eddington Number
https://pintia.cn/problem-sets/994805342720868352/problems/994805354762715136 British astronomer Edd ...
- PAT 1117 Eddington Number
British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, h ...
- 1024 Palindromic Number (25 分)
A number that will be the same when it is written forwards or backwards is known as a Palindromic Nu ...
- 1117 Eddington Number
题意:给出了N个数字,确定一个尽可能大的数字E,要求这N个数字中大于E的数字有E个. 思路: 乍一看不知道题目在说啥.静下心来多读几遍题目,在草稿纸上比划比划,发现是个大水题.解释一下样例,原始序列为 ...
随机推荐
- ansible 删除路径下的多个文件[收集的参考]
How to delete multiple files / directories in Ansible ansible - find, file modules to delete files a ...
- 2019.1.5 China’s population
China’s population is expected to hit a peak of 1.44 billion in 2029, and start to experience negati ...
- eclipse集成svn后总是弹出 Password Required问题解决方法
最近在集成svn后,在打开eclipse后总是一遍遍的弹出 Password Required,即使输入正确的用户名以及密码也会弹出,最后发现是eclipse的Network Connections ...
- 源代码管理:SVN源代码管理器在ASP.NET VS中的使用注意事项
一共有三个软件 1.ASP.NET下SVN有三个是不受管理的,bin文件夹,obj文件夹,.user类型文件,位置在TortoiseSVN的Settings下面的Subversion下的[Global ...
- PAT 列车厢调度 (25分)(栈和容器的简单应用)
1 ====== <--移动方向 / 3 ===== \ 2 ====== -->移动方向 大家或许在某些数据结构教材上见到过“列车厢调度问题”(当然没见过也不要紧).今天,我们就来实际操 ...
- Foundation--结构体
一,NSRange typedef struct _NSRange { NSUInteger location; NSUInteger length; }NSRange; 这个结构体用来表示事物的一个 ...
- shell 脚本实战笔记(5)--搭建资源的镜像服务器
背景: 由于访问国外站点资源, 有时特别慢. 偶尔一次下载, 肯定还能忍受, 对于多次使用或者小团队内部使用, 搭建一个镜像站点, 无疑是个明智的决定. 这边以搭建CDH5的yum源镜像, 作为例子, ...
- Visual Studio Code打造Markdown编辑器
1.准备工作: OS:Windows10 专业版或企业版 安装:Visua Studio Code,版本 1.23 (2018-5-3) 官网下载:https://github.com/Microso ...
- 实验吧—隐写术——WP之 欢迎来到地狱
解压压缩包后出现三个文件.jpg .zip .docx 发现图片打开不显示,用winhex打开发现缺少文件头,将jpg的文件头补上 保存后图片可以打开 是一个百度网盘的链接,注意l和1的区别,网盘里是 ...
- 实验吧—Web——WP之 头有点大
3. 首先看一下 .net framework 9.9 并没有9.9版本 可以考虑浏览器伪装用户代理 就得了解User-Agent ???何为user-agent User-Agent是Http协议中 ...