bucking_conion @ 2024-10-19 09:29:49
k = int(input())
n = 0
Sn = 0
while k>=Sn:
Sn+=1//(n+1)
n+=1
print(n)
by zhaoyikuan @ 2024-10-19 19:59:06
@bucking_conion
k = int(input())
n = 0
Sn = 0.0
while Sn <= k:
Sn+= 1/(n + 1)
n+=1
print(n)
“//”是整除,所以他一直在加0导致TLE,并且这个Sn得是浮点数