python 0分求助

P1035 [NOIP2002 普及组] 级数求和

G994056865 @ 2021-08-11 22:00:58

k = int(input("请输入一个整数k:"))
s = 0
n = 0
while s <= k:
    n = n + 1
    s = (1 / n) + s
print(n)

自己测也能出来啊,大佬们帮帮忙啊


by liuzimingc @ 2021-08-11 22:03:50

请输入一个整数k:


by liuzimingc @ 2021-08-11 22:04:45

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

|