当前位置:网站首页>1060 爱丁顿数 (25 分)
1060 爱丁顿数 (25 分)
2022-08-03 05:09:00 【破烂摆烂人】
英国天文学家爱丁顿很喜欢骑车。据说他为了炫耀自己的骑车功力,还定义了一个“爱丁顿数” E ,即满足有 E 天骑车超过 E 英里的最大整数 E。据说爱丁顿自己的 E 等于87。
现给定某人 N 天的骑车距离,请你算出对应的爱丁顿数 E(≤N)。
输入格式:
输入第一行给出一个正整数 N (≤10
5
),即连续骑车的天数;第二行给出 N 个非负整数,代表每天的骑车距离。
输出格式:
在一行中给出 N 天的爱丁顿数。
输入样例:
10
6 7 6 9 3 10 8 2 7 8
输出样例:
6
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int cmp(const void *a, const void *b) {
return *(int *)b - *(int *)a;//降序
}
int main(int argc, char *argv[]) {
int n ;
scanf("%d",&n) ;
int a[100000] ;
int i , j ;
int cnt = 0 , tmp;
for( i = 0 ; i < n ; i++ ){
scanf("%d",&a[i]) ;
}
qsort(a,n,sizeof(int),cmp) ;
for( i = 0 ; i < n ; i++ ){
if( i+1 < a[i] ){
cnt++ ;
}
}
printf("%d",cnt) ;
return 0;
}
边栏推荐
- Common lipophilic cell membrane dyes DiO, Dil, DiR, Did spectrograms and experimental procedures
- 2022/08/02 Study Notes (day22) Multithreading
- 【Harmony OS】【FAQ】鸿蒙问题合集1
- Where is the value of testers
- Interface testing framework combat (3) | JSON request and response assertion
- 技术分享 | 接口自动化测试中如何对xml 格式做断言验证?
- User password encryption tool
- Coordinate knowledge in digital twin campus scenarios
- PotPlayer实现上班摸鱼电视自由
- 获取Ip工具类
猜你喜欢
![[Harmony OS] [ArkUI] ets development graphics and animation drawing](/img/36/f4c91f794b1321f11a24505d1617fb.png)
[Harmony OS] [ArkUI] ets development graphics and animation drawing

Interface Test Framework Practice (4) | Get Schema Assertion

阿里云对象存储oss私有桶生成链接

在树莓派上搭建属于自己的网页(2)

Harmony OS Date ano UI 】 【 】 the basic operation

WinForm的控件二次开发

常见荧光染料修饰多种基团及其激发和发射波长数据一览数据

typescript39-class类的可见修饰符

探索性测试的概念及方法

接口测试框架实战(四)| 搞定 Schema 断言
随机推荐
js实现一个 bind 函数
tag单调栈-单调栈预备知识-lt.739. 每日温度
BIOTIN ALKYNE CAS:773888-45-2价格,供应商
Peptides mediated PEG DSPE of phospholipids, targeted functional materials - PEG - RGD/TAT/NGR/APRPG
typescript41-class类的私有修饰符
接口测试实战| GET/POST 请求区别详解
typescript45-接口之间的兼容性
在线密码生成工具推荐
MCM箱模型建模方法及大气O3来源解析
Alienware上线首个数字时装AR试穿体验
13.< tag-动态规划和回文字串>lt.647. 回文子串 + lt.516.最长回文子序列
Tributyl-mercaptophosphane "tBuBrettPhos Pd(allyl)" OTf), 1798782-17-8
Flink state
常见亲脂性细胞膜染料DiO, Dil, DiR, Did光谱图和实验操作流程
Practical application of WebSocket
内部类、static关键字、final
移动流量的爆发式增长,社交电商如何选择商业模式
刚上线就狂吸70W粉,新型商业模式“分享购”来了,你知道吗?
High availability, two locations and three centers
MOSN 反向通道详解