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个. 思路: 乍一看不知道题目在说啥.静下心来多读几遍题目,在草稿纸上比划比划,发现是个大水题.解释一下样例,原始序列为 ...
随机推荐
- 入门级:理解FAT32文件系统(转载翻译)
FAT(File Allocation Table ) 这个网页的目的是帮助你理解怎么样在微软FAT32文件系统下取得数据,处理的硬盘的大小通常在500M到几百G之间.FAT是一个相对简单和纯净的文件 ...
- 三步解决 vue 按需加载
1 webpack 的 output 配置 chunkFleName 树干名称: " chunks/[name]-[chunkhash:8].js " 这一步是配合第三步, 生 ...
- opencv-python教程学习系列12-图像阈值
前言 opencv-python教程学习系列记录学习python-opencv过程的点滴,本文主要介绍图像阈值/二值化,坚持学习,共同进步. 系列教程参照OpenCV-Python中文教程: 系统环境 ...
- opencv-python教程学习系列6-用滑动条做调色板
前言 opencv-python教程学习系列记录学习python-opencv过程的点滴,本文主要介绍opencv-python用滑动条做调色板,坚持学习,共同进步. 系列教程参照OpenCV-Pyt ...
- hihocoder1545 : 小Hi和小Ho的对弈游戏(树上博弈&nim博弈)
描述 小Hi和小Ho经常一起结对编程,他们通过各种对弈游戏决定谁担任Driver谁担任Observer. 今天他们的对弈是在一棵有根树 T 上进行的.小Hi和小Ho轮流进行删除操作,其中小Hi先手. ...
- MySQL设置默认编码
查看默认编码:show variables like "char%" MySQL5.5以下版本: 1.打开配置文件 2.在[client]和[mysqld]字段下面均添加defau ...
- ajax请求成功回调函数没有执行问题
如下常见的ajax前端请求,请求成功后success:function(result){ 这里的数据没有执行 }: $.ajax({ type:"post", url:" ...
- 图片加载完毕后执行JS代码
$("#img").load(function(){...}); 这是jquery提供的一个方法,但是在IE中会有BUG,IE8不支持,IE9以上刷新后也不会执行,只有强制刷新才执 ...
- Ubuntu 16.04下指定Sublime Text 3 默认python编译版本
安装PackageResourceViewer插件 输入 Ctrl+Shift+P 输入install,选择Package Control: Install Package 选择PackageReso ...
- USB速率识别
低速设备D-上有一个1.5k欧的上拉电阻.高速和全速设别在D+上有一1.5k欧上拉电阻.连接后通过检测电压变化来了解设备是否为低速设别. 低速下:D+为“0”,D-为“1”是为“J”状态,“K”状态相 ...