![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
文章平均质量分 76
black_miracle
这个作者很懒,什么都没留下…
展开
-
线性同余方程ax≡b(mod m)
a,b,m是整数且m>0,gcd(a,m)=d,如果d|b,则方程恰有d个模m不同余的解,否则方程无解。a=d*a0 m=d*m0a0*x+m0*y=b/d可以转化为扩展欧几里得typedef long long ll;void exgcd(ll a,ll b,ll &d,ll &x,ll &y){ if(b==0){ x=1; y=0; d=a; retur原创 2016-09-09 12:05:35 · 3549 阅读 · 0 评论 -
HDU 5974 数论
A Simple Math ProblemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Problem DescriptionGiven two positive integers a and b,find suitable X and Y to me原创 2016-11-07 18:13:07 · 1516 阅读 · 0 评论 -
HDU 5976 逆元
DetachmentTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Problem DescriptionIn a highly developed alien society, the habitats are almost infinite dime原创 2016-11-06 21:24:15 · 1640 阅读 · 0 评论 -
2016-2017 CT S03E08: Codeforces Trainings Season 3 Episode 8 K1 gcd
FairWarningOn our planet, Jamcode IX, threeGreat Events occurred. They happened 26000, 11000 and 6000 slarboseconds ago.In 4000 slarboseconds, the amount of time since all of those events will bemul原创 2016-11-09 19:50:21 · 1944 阅读 · 0 评论 -
HDU 5901 1-n中素数个数
Count primesTime Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Problem DescriptionEasy question! Calculate how many primes between [1...n]! Inp转载 2016-09-19 16:35:49 · 850 阅读 · 0 评论 -
SPOJ FACVSPOW 数论+二分
Factorial vs PowerConsider two integer sequences f(n) = n! and g(n) = an, where n is a positive integer. For any integer a > 1 the second sequence is greater than the first for a finite number原创 2017-02-20 17:23:53 · 367 阅读 · 0 评论 -
Codeforces 396B 数论
On Sum of Fractionstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's assume thatv(n) is the larg原创 2017-02-23 13:37:46 · 246 阅读 · 0 评论 -
Codeforces 487C 数论+构造
Prefix Product Sequencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputConsider a sequence [a1, a2, ... ,原创 2017-02-01 23:24:28 · 361 阅读 · 0 评论 -
Codeforces 776E 数论
The Holmes Childrentime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Holmes children are fighting over w原创 2017-02-25 22:24:54 · 611 阅读 · 0 评论 -
Codeforces 711E 数论
ZS and The Birthday Paradoxtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputZS the Coder has recently found原创 2017-02-27 15:31:40 · 331 阅读 · 0 评论 -
Codeforces 303A 构造+数论
Lucky Permutation Tripletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBike is interested in permutations原创 2017-03-14 20:06:39 · 369 阅读 · 0 评论 -
Codeforces gym 101343 A 数论
On The Way to Lucky Plazatime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlaa is on her last day in Singapo原创 2017-04-16 18:05:14 · 845 阅读 · 0 评论 -
HDU 5895 矩阵快速幂+欧拉函数
Mathematician QSCTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Problem DescriptionQSC dream of becoming a mathematician, he believes that everythin原创 2016-09-19 16:29:41 · 341 阅读 · 0 评论 -
NEFU 84 扩展欧几里得
五指山Problem:84Time Limit:1000msMemory Limit:65536KDescription西游记中孙吾空大闹天宫,如来佛祖前来降伏他,说道:“我与你打个赌赛;你若有本事,一筋斗打出我这右手掌中,算你赢,再不用动刀兵苦争战,就请玉帝到西方居住,把天宫让你;若不原创 2016-08-14 10:43:15 · 292 阅读 · 0 评论 -
POJ 2891 多元同余线性方程
Strange Way to Express IntegersTime Limit: 1000MS Memory Limit: 131072K DescriptionElina is reading a book written by Rujia Liu, which introduces a strange wa原创 2016-09-09 13:47:14 · 333 阅读 · 0 评论 -
HDU 1573 多元同余线性方程
X问题Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem Description求在小于等于N的正整数中有多少个X满足:X mod a[0] = b[0], X mod a[1] = b[1], X mod a[2] = b[2], …, X原创 2016-09-09 16:30:32 · 328 阅读 · 0 评论 -
HDU 3292 佩尔方程+矩阵快速幂
No more tricks, Mr NanguoTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Problem DescriptionNow Sailormoon girls want to tell you a ancient idiom sto原创 2016-09-13 12:34:51 · 391 阅读 · 0 评论 -
a*b%k
a=100000000000000000 b=100000000000000001 k=100000000000000002我的计算方法为(a%k*b%k)%k毫无疑问,爆了。算这个的方法是快速幂typedef long long ll;ll solve(ll a,ll k,ll mod){ ll n = 0; while(k){原创 2016-04-24 21:51:54 · 1043 阅读 · 0 评论 -
POJ 3696 欧拉函数
The Luckiest numberTime Limit: 1000MS Memory Limit: 65536K DescriptionChinese people think of '8' as the lucky digit. Bob also likes digit '8'. Moreover, Bob原创 2016-09-14 13:55:33 · 276 阅读 · 0 评论 -
POJ 2992 因子个数
DivisorsTime Limit: 1000MS Memory Limit: 65536K DescriptionYour task in this problem is to determine the number of divisors of Cnk. Just for fun -- or do you ne原创 2016-09-15 16:03:55 · 227 阅读 · 0 评论 -
POJ 1061 扩展欧几里得
青蛙的约会Time Limit: 1000MS Memory Limit: 10000K Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,原创 2016-08-12 22:48:26 · 254 阅读 · 0 评论 -
POJ 1845 约数和+二分等比和+逆元
SumdivTime Limit: 1000MS Memory Limit: 30000K DescriptionConsider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modu原创 2016-09-16 14:16:35 · 261 阅读 · 0 评论 -
矩阵快速幂
情书抄写员——高级Time Limit: 1000MS Memory Limit: 1000K DescriptionWind的女友数量是惊人的。每个月开始时,Wind的每一个正式女友都会给他介绍k个新的女生,我们称这样的新人为“潜在的女友”(Potential GirlFriend)。通过近两个月的交往,潜在的女原创 2016-08-12 22:53:58 · 309 阅读 · 0 评论 -
中国剩余定理
中国剩余定理Time Limit: 1000MS Memory Limit: 1000K Description《孙子算经》中有“物不知数”问题:“今有物不知其数,三三数之余二 ,五五数之余三 ,七七数之余二,问物几何?”答为“23”。--------这个就是传说中的“中国剩余定理”。 其实题目的意思就是,n原创 2016-08-12 21:14:32 · 350 阅读 · 0 评论 -
欧拉函数
欧拉函数Time Limit: 1000MS Memory Limit: 1000K Description在数论,对正整数n,欧拉函数是少于或等于n的数中与n互质的数的数目。此函数以其首名研究者欧拉命名,它又称为Euler's totient function、φ函数、欧拉商数等。 例如φ(8)=4,因为1,3,5,原创 2016-08-12 21:12:02 · 621 阅读 · 0 评论 -
HDU 6053 TrickGCD 数论
TrickGCDTime Limit: 5000/2500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2532 Accepted Submission(s): 965Problem DescriptionYou are given an原创 2017-08-01 00:41:25 · 313 阅读 · 0 评论