#include <stdio.h> #include <math.h> int main(){ int m,n; double s=0.0; if (scanf("%d",&m)!=EOF && scanf("%d",&n)!=EOF && m<=n){ for (int i=m;i<=n;i++){ s+=(i*i+1.0/i); } printf("sum = %.6f",s); }else{ printf("intput m n wrong"); } return 0; }
#include <stdio.h> #include <math.h> int main(){ int m,n; double s=0.0; if (scanf("%d",&m)!=EOF && scanf("%d",&n)!=EOF && m<=n){ for (int i=m;i<=n;i++){ s+=(i*i+1.0/i); } printf("sum = %.6f",s); }else{ printf("intput m n wrong"); } return 0; }
天 : 20083
小时 : 468606
分钟 : 28116334
秒 : 1686980040