BC85 牛牛学数列3

思路:

step1:找规律,计算;

代码如下:

n = int(input())
i = 1
c = 0
while i <= n:
    c += (-1)**(i+1) * (1/i)
    i += 1
c = c + 0.0000000001
print('{:.3f}'.format(c))