![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
njupt_wrj
这个作者很懒,什么都没留下…
展开
-
Educational Codeforces Round 39 Editorial B(Euclid算法,连续-=与%=的效率)
You have two variables a and b. Consider the following sequence of actions performed with these variables:If a = 0 or b = 0, end the process. Otherwise, go to step 2;If a ≥ 2·b, then set the value of ...原创 2018-03-07 16:20:24 · 241 阅读 · 0 评论 -
牢记gcd最大公因数和lcm最小公倍数
由于不会辗转相除法,在不能带资料的比赛中肯定会吃亏。上次天体报名赛就现场找规律写了个gcd,虽然过了但是很丢人啊啊啊。。 直接进入正题,gcd有以下恒等式:gcd(a, b) = gcd (a, a mod b),并且边界条件gcd(a, 0) = a;这里假设a>=b 于是gcd函数就出来了int gcd(int a, int b){ return b == 0 ? a : ...原创 2018-03-24 22:43:56 · 485 阅读 · 0 评论 -
Newcoder Wannafly13 B Jxy军训(费马小定理、分数在模意义下的值)
链接:https://www.nowcoder.com/acm/contest/80/B题目描述 在文某路学车中学高一新生军训中,Jxc正站在太阳下站着军姿,对于这样的酷热的阳光,Jxc 表示非常不爽。 Jxc将天空看做一个n*n的矩阵,此时天上有m朵云,这些云会随机分布在m个不同的位置,同时太阳会随机出现在一个位置,Jxc想知道他被太阳晒到的概率是多少,由于他仍在站军姿,所以这...原创 2018-04-07 16:51:39 · 425 阅读 · 0 评论 -
HDU 1005 Number Sequence(矩阵快速幂,快速幂模板)
Problem DescriptionA number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the value of f(n). InputThe input cons...原创 2018-04-16 20:35:54 · 240 阅读 · 0 评论