Patest 1060. 爱丁顿数(25) (python)

来源:互联网 发布:毛利胜永 知乎 编辑:程序博客网 时间:2024/06/14 11:22
1060. 爱丁顿数(25)


时间限制
250 ms
内存限制
65536 kB
代码长度限制
8000 B
判题程序
Standard
作者
CHEN, Yue
英国天文学家爱丁顿很喜欢骑车。据说他为了炫耀自己的骑车功力,还定义了一个
“爱丁顿数”E,即满足有E天骑车超过E英里的最大整数E。据说爱丁顿自己的E等于87。


现给定某人N天的骑车距离,请你算出对应的爱丁顿数E(<=N)。


输入格式:


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


输出格式:


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


输入样例:
10
6 7 6 9 3 10 8 2 7 8
输出样例:

6

numberOfElement = int(input())array = input().split(" ")for i in range(0,numberOfElement):    array[i] = int(array[i])def fullFill(e):    beyond = 0    for i in range(0,numberOfElement):        if array[i] > e:            beyond += 1    if beyond >= e:        return True    else:        return Falseindex = numberOfElementwhile(fullFill(index) == False):    if index == 0:        break    index -= 1print(index)


0 0
原创粉丝点击