标签:
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1333 Accepted Submission(s): 440
#include <cstdio> #include <cstring> const int MAXN = 1e6+5; double sum[MAXN]; char s[MAXN]; void init() { sum[0] = 0; for(int i = 1; i <= 1000000; ++i){ sum[i] = sum[i-1]+1.0/(i*1.0*i); } } int main() { init(); while(~scanf("%s", s)){ int len = strlen(s); if(len >= 7){ printf("1.64493\n"); continue; } int n = 0; for(int i = 0; i < len; ++i) n = n*10+s[i]-‘0‘; printf("%.5f\n", sum[n]); } return 0; }
标签:
原文地址:http://www.cnblogs.com/inmoonlight/p/5894036.html