P1035 - 不知道是哪个值错了
查看原帖
P1035 - 不知道是哪个值错了
928411
nsh_de_tt楼主2023/2/6 21:18

rt.以下为代码:

k = int(input())
s = 1.0
n = 2
while k < s:
    s += 1 / n
    n += 1
print(int(n))

实机测试:

输入样例1:

1

输出样例1:

2

输入样例2:

5

输出样例2:

2
2023/2/6 21:18
加载中...