PAT (Advanced Level) Practise 1117Eddington Number(25)
来源:互联网 发布:淘宝 全球买手 直播 编辑:程序博客网 时间:2024/06/05 10:22
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(<=105), 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:106 7 6 9 3 10 8 2 7 8Sample Output:
6
#include<set>#include<map>#include<ctime>#include<cmath>#include<stack>#include<queue>#include<bitset>#include<cstdio>#include<string>#include<cstring>#include<iostream>#include<algorithm>#include<functional>#define rep(i,j,k) for (int i = j; i <= k; i++)#define per(i,j,k) for (int i = j; i >= k; i--)#define loop(i,j,k) for (int i = j;i != -1; i = k[i])#define lson x << 1, l, mid#define rson x << 1 | 1, mid + 1, r#define ff first#define ss second#define mp(i,j) make_pair(i,j)#define pb push_back#define pii pair<int,LL>#define in(x) scanf("%d", &x);using namespace std;typedef long long LL;const int low(int x) { return x&-x; }const double eps = 1e-4;const int INF = 0x7FFFFFFF;const int mod = 998244353;const int N = 1e5 + 10;int n, m, a[N];int main(){ scanf("%d", &n); rep(i, 1, n) scanf("%d", &a[i]); sort(a + 1, a + n + 1, greater<int>()); int ans = n; rep(i, 1, n) if (a[i] <= i) { ans = i - 1; break; } printf("%d\n", ans); return 0;}
- PAT (Advanced Level) Practise 1117Eddington Number(25)
- PAT (Advanced Level) Practise 1117 Eddington Number(25)
- 【PAT】【Advanced Level】1117. Eddington Number(25)
- 1024. Palindromic Number (25) @ PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise 1024 Palindromic Number (25)
- PAT (Advanced Level) Practise 1082 Read Number in Chinese (25)
- PAT (Advanced Level) Practise 1082 Read Number in Chinese (25)
- PAT (Advanced Level) Practise 1024 Palindromic Number (25)
- [PAT] (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- PAT (Advanced Level) Practise
- 第一篇博客记载于2016-9-12
- solr教程,值得刚接触搜索开发人员一看
- POJ 2965 The Pilots Brothers' refrigerator 高斯消元
- android命名大小写问题
- Android NDK简单实例和环境搭建
- PAT (Advanced Level) Practise 1117Eddington Number(25)
- Style 和 Theme 的异同
- SpannableString实现同一段文字不同的效果
- <机器学习笔记-04 ><scikit-learn 04>逻辑回归
- 对称加密与非对称加密
- [Android] Android Studio 中遇到的一些问题
- CSUOJ 1812 三角形和矩形
- PAT (Advanced Level) Practise 1118Birds in Forest (25)
- 插入排序