
数论
@小阿宝
这个作者很懒,什么都没留下…
展开
-
Harmonic Number LightOJ - 1234
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.InputInput starts with an integer T (≤ 10000), denoting the number of test cases.Each cas原创 2020-11-02 19:52:55 · 124 阅读 · 0 评论 -
Harmonic Number (II) LightOJ - 1245(数论)
I was trying to solve problem '1234 - Harmonic Number', I wrote the following codelonglongH(intn){ longlongres=0; for(inti=1;i<=n;i++) res=res+n/i; returnres;}Yes, my error was that I was using the inte...原创 2020-11-02 19:20:02 · 85 阅读 · 0 评论 -
数论---------唯一分解定理及其应用
唯一分解定理一个最重要的应用,就是在于计算非常大的数据时(例如组合数、大的阶乘数),便可以将运算过程放在素数表上,将乘除法变成素数指数的加减法,这样就会避免计算的结果其实很小但是中间过程就爆掉数据类型的情况。 应用1:大型组合数的求解(uva 10375). 已知C(m,n) = m!/(n!(m-n)!),现在给出p、q、r、s(p≥q,r≥s,p、q、r、s≤10000),计算C(p,q)/C(r,s)。输出结果不超过100000000,保留五位小数。 分析:计算组合数时间上没...原创 2020-10-30 20:41:03 · 553 阅读 · 0 评论