题意: 求调和级数,但n很大啦.. 解析: 分段打表  每间隔50存储一个数,在计算时  只需要找到离输入的n最近的那个数 以它为起点 开始计算即可 emm...补充一下调和级数的运算公式   r为常数,r=0.57721566490153286060651209(r就是欧拉常数). 看一下这位的博客:https://www.cnblogs.com/weiyuan/p/5737273.html #include <iostream> #include <cstdio> #inclu…
题目给的时间限制是3s,所以可以直接暴力来做,注意n的取值范围是1e8,如果开一个1e8的数组会RE.分段打表,可以每100个数记录一次,然后对每次询问先找到它所在的区间,然后在暴力往后找.(学到了~~) #include<bits/stdc++.h> using namespace std; ; double mp[N]; void inint(){ ; ;i<=;i++){ ans+=(double)1.0/i; ==) mp[i/]=ans; } } int main(){ ini…
Harmonic Number Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1234 Description In mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers: In this p…
http://lightoj.com/volume_showproblem.php?problem=1234 Harmonic Number Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1234 Description In mathematics, the nth harmonic number is the sum of th…
D - Harmonic Number Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1234 Description In mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers: In th…
Harmonic Number In mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers: In this problem, you are given n, you have to find Hn. Input Input starts with an integer T (≤ 10000), denoting the number of test c…
题解:隔一段数字存一个答案,在查询时,只要找到距离n最近而且小于n的存答案值,再把剩余的暴力跑一遍就可以. #include <bits/stdc++.h> using namespace std; const int N = 1e8 + 10; const int M = 2e6 + 10; double a[M]; void Init() { a[0] = 0.0; double ans = 1; for( int i = 2; i < N; i ++) { ans += 1.0 /…
原题链接http://acm.hust.edu.cn/vjudge/contest/121397#problem/A Description In mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers: In this problem, you are given n, you have to find Hn. Input Input starts wit…
http://lightoj.com/volume_showproblem.php?problem=1245 G - Harmonic Number (II) Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1245 Description I was trying to solve problem '1234 - Harmonic…
题目链接:https://vjudge.net/problem/LightOJ-1234 1234 - Harmonic Number    PDF (English) Statistics Forum Time Limit: 3 second(s) Memory Limit: 32 MB In mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers: In…