#include <stdio.h> int main() { int n; scanf("%d", &n); int k = -1;//-1的n次方作循环变量 double sum = 0.0; int s = 0; double t = 0; for (int j = 1; j <= 2 * n - 1 ; j = j + 2) { k = (-1) * k; s = s + j * k; t = 1.0 / s; sum = sum + t; } printf("%.3lf", sum); return 0; }