Harmonic Number LightOJ - 1234 ??????????????????
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Harmonic Number LightOJ - 1234 ??????????????????相关的知识,希望对你有一定的参考价值。
?????????code def std fine name fonts TE freopen ==
?????????
?????????????????????n???????????????
?????????
???????????? ?????????50?????????????????????????????? ???????????????????????????n?????????????????? ??????????????? ??????????????????
emm????????????????????????????????????????????????
r????????????r=0.57721566490153286060651209???r????????????????????????
???????????????????????????https://www.cnblogs.com/weiyuan/p/5737273.html
#include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set> #include <vector> #include <stack> #include <queue> #include <algorithm> #include <cmath> #define MOD 2018 #define LL long long #define ULL unsigned long long #define maxn 100000000 #define Pair pair<int, int> #define mem(a, b) memset(a, b, sizeof(a)) #define _ ios_base::sync_with_stdio(0),cin.tie(0) //freopen("1.txt", "r", stdin); using namespace std; const int LL_INF = 0x7fffffffffffffff,INF = 0x3f3f3f3f; double ch[maxn/50+10]; int main() { int T, cnt = 1; double sum = 0; ch[0] = 0; for(int i=1; i<=maxn; i++) { sum += 1/(double)i; if(i % 50 == 0) ch[cnt++] = sum; } int kase = 0; cin>> T; while(T--) { int n; cin>> n; double m = ch[n/50]; for(int i=n/50*50+1; i<=n; i++) m += 1/(double)i; printf("Case %d: %.10f ",++kase,m); } return 0; }
以上是关于Harmonic Number LightOJ - 1234 ??????????????????的主要内容,如果未能解决你的问题,请参考以下文章
Harmonic Number LightOJ - 1234 ??????????????????
1245 - Harmonic Number (II)---LightOJ1245
LightOJ1234 Harmonic Number 调和级数求和