标签:
#include "stdio.h" #include "math.h" int main(void){ int num; while(scanf("%d", &num) != EOF){ int i; for(i=0; i<num; i++){ //循环次数 int j; int number; double sum = 0; scanf("%d", &number); for(j=1; j<=number; j++){ sum += 1.0/j * pow(-1,j+1); } printf("%.2lf\n", sum); } } return 0; }
标签:
原文地址:http://www.cnblogs.com/cnfanhua/p/4220940.html