hdu 5879 -Cure 暴力打表
2016-09-17 18:21
357 查看
Given an integer n,
we only want to know the sum of 1/k2 where k from 1 to n
直接暴力1-1e6打表.
超过之后会收敛
we only want to know the sum of 1/k2 where k from 1 to n
直接暴力1-1e6打表.
超过之后会收敛
#include <cstdio> #include <cmath> #include <cstring> #include <string> #include <algorithm> #include <iostream> #include <queue> #include <map> #include <set> #include <vector> using namespace std; typedef long long ll; double ans[1000000+5]; char ss[5000001]; int len; int change(char *s) { int base=0,sum=0; for (int i=0; i<len; i++) { sum=sum*10+s[i]-'0'; } return sum; } int main() { //1.644934 // 1.644934; for (int i=1; i<=1000000; i++) { ans[i]=ans[i-1]+1.0/i/i; } while(scanf("%s",ss)!=EOF) { len=strlen(ss); if (len>6) printf("1.64493\n"); else { int n= change(ss); printf("%.5lf\n",ans ); } } return 0; }
相关文章推荐
- HDU-5879-Cure-打表模拟(水)
- [HDU 5879] Cure (数学+打表)
- HDU 5879 Cure(打表)qingdao网赛
- 【HDU 5879】Cure(暴力+优化)
- HDU 5879 Cure(打表预处理)
- hdu_5879_Cure(打表)
- hdu 5879 Cure 打表
- hdu 5879 Cure 2016ACM/ICPC青岛赛区网络赛1002
- HDU 5879 Cure -2016 ICPC 青岛赛区网络赛
- HDU 5879 Cure
- hdu 1443 Joseph+暴力打表
- HDU-5317 RGCDQ ,暴力打表!
- HDU 1005 Number Sequence【多解,暴力打表,鸽巢原理】
- hdu 1331 (暴力打表)
- Hdu 5793 A Boring Question【暴力打表+找规律+求逆元+快速幂+快速积】
- HDU 5879 Cure【数论】
- HDU 1061暴力打表找规律
- HDU-5879 Cure(精度)(极限)
- hdu 5512 Pagodas【暴力打表+找规律】
- 2016 多校第一场 hdu 5276((线段树+暴力打表)|(RMQ + 二分))