#include <stdio.h> int main(){ int N; double sum=0.0; int i; int s=1; if (scanf("%d",&N)!=EOF){ for (i=0;i<N;i++){ sum+=s*1.0/(1+3*i); s*=-1; } printf("sum = %.3f",sum); }else{ printf("int N wrong"); } return 0; }
#include <stdio.h> int main(){ int N; double sum=0.0; int i; int s=1; if (scanf("%d",&N)!=EOF){ for (i=0;i<N;i++){ sum+=s*1.0/(1+3*i); s*=-1; } printf("sum = %.3f",sum); }else{ printf("int N wrong"); } return 0; }
天 : 20052
小时 : 467878
分钟 : 28072650
秒 : 1684359000