2022-08-18 10:53:07 +08:00

21 lines
649 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# N - Harmonic Number
* https://vjudge.net/contest/509210#problem/N
### 题意
h(n)=1/1+1/2+……+1/n;n<=1e8
### 做法(2种)
对应两个代码
1.分层打表每50/100个记录一次查的时候再接着算
2.调和级数近似公式前1e4打表后面的调和级数近似公式因为此公式只适用于n很大的情况
### 关键词
基础数论、调和级数近似公式、分层打表、欧拉常数
### 易错点
* //lf->double 不是llf
* //cmath 中log就是ln
* 直接用int/long long扩大倍数打表
### 工具箱
* doubl&%lf https://blog.csdn.net/weixin_46585199/article/details/119044763
* 调和级数近似公式f(n)=ln(n)+r+1.0/(2*n),r是欧拉常数
//注意此公式只适用于n很大的情况。
* #define r 0.57721566490153286060651209//欧拉常数