n=eval(input())
a = 1
b = 1
d=1
if n==1:
print('{:.6f}'.format(1))
else:
for i in range(1,n):
c = a+b
a = b
b = c
d=d+pow(-1,i)*(i/c)
print('{:.6f}'.format(d))
Python前n项和
于 2022-03-29 15:12:42 首次发布
n=eval(input())
a = 1
b = 1
d=1
if n==1:
print('{:.6f}'.format(1))
else:
for i in range(1,n):
c = a+b
a = b
b = c
d=d+pow(-1,i)*(i/c)
print('{:.6f}'.format(d))