PAT-A1117/B1060 Eddington Number/爱丁顿数 题目内容及题解

这篇博客介绍了Eddington Number(爱丁顿数)的概念,源于英国天文学家爱丁顿。题目要求计算在给定的骑行天数和每天距离中,最大的整数E,使得有E天骑行距离超过E英里。博客提供了输入输出规格,并给出了一个样例输入和输出。解题思路包括对数据进行排序,然后遍历找到满足条件的E值。最后,博主给出了代码实现和运行结果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

英国天文学家爱丁顿很喜欢骑车。据说他为了炫耀自己的骑车功力,还定义了一个“爱丁顿数” E ,即满足有 E 天骑车超过 E 英里的最大整数 E。据说爱丁顿自己的 E 等于87。

现给定某人 N 天的骑车距离,请你算出对应的爱丁顿数 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.

输入第一行给出一个正整数 N (≤10​5​​),即连续骑车的天数;第二行给出 N 个非负整数,代表每天的骑车距离。

Output Specification:

For each case, print in a line the Eddington number for these N days.

在一行中给出 N 天的爱丁顿数。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值