第2章-6 求交错序列前N项和 a = int(input()) tot = 0.0 op = 1 for i in range(1, a + 1): tot += i / (2 * i - 1) * op op *= -1 print("%.3f" % tot)