题解 | #牛牛学数列3#
牛牛学数列3
http://www.nowcoder.com/practice/f65c726d081c4160a9356eabf0dc21d9
n = int(input())
m = 0
s = 0
for i in range(1, n+1):
m += (-1)**(i-1)*(2*i-1)
s += 1/m
print("%.3f" % s)
牛牛学数列3
http://www.nowcoder.com/practice/f65c726d081c4160a9356eabf0dc21d9
n = int(input())
m = 0
s = 0
for i in range(1, n+1):
m += (-1)**(i-1)*(2*i-1)
s += 1/m
print("%.3f" % s)
相关推荐