
最大公约数
文章平均质量分 68
wwt9b15bs
这个作者很懒,什么都没留下…
展开
-
【题解】LightOJ1024 最小公倍数
题目链接//求最小公倍数 #include<cstdio>#include<cstring>#include<algorithm>#include<cmath>using namespace std;const int N=1e5+10;int ans[N],cnt[N],len;//ans记录答案,cnt记录因子原创 2018-08-10 22:57:52 · 257 阅读 · 0 评论 -
【题解】codeforces1058G[Codeforces Round #512 Div.2]G.Linear Congruential Generator LCM+数学知识
DescriptionYou are given a tuple generator f(k)=(f1(k),f2(k),⋯ ,fn(k))f^{(k)}=(f^{(k)}_1,f^{(k)}_2,\cdots,f^{(k)}_n)f(k)=(f1(k),f2(k),⋯,fn(k)), where fi(k)=(ai⋅fi(k−1)+bi)mod&Thi...转载 2018-09-27 21:27:57 · 480 阅读 · 0 评论 -
【题解】codeforces1058D[Codeforces Round #512 D]D.Vasya and Triangle 最大公约数
题目链接DescriptionVasya has got three integers nnn, mmm and kkk. He’d like to find three integer points (x1,y1)(x_1,y_1)(x1,y1), (x2,y2)(x_2,y_2)(x2,y2), (x3,y3)(x_3,y_3)(x3,y3), such that 0≤x1,x...原创 2018-09-26 23:15:39 · 392 阅读 · 0 评论 -
【题解】codeforces664A Complicated GCD 最大公约数
题目链接DescriptionGreatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algor...原创 2018-09-20 09:43:05 · 349 阅读 · 0 评论 -
【题解】洛谷P2152(LibreOJ10205)[SDOI2009]Super GCD 高精度+更相减损术
题目链接题目描述Sheng bill有着惊人的心算能力,甚至能用大脑计算出两个巨大的数的GCD(最大公约 数)!因此他经常和别人比赛计算GCD。有一天Sheng bill很嚣张地找到了你,并要求和你比 赛,但是输给Sheng bill岂不是很丢脸!所以你决定写一个程序来教训他。输入输出格式输入格式:共两行: 第一行:一个数AAA。 第二行:一个数BBB。输出格式:一行,表示AAA和B...原创 2018-09-20 09:18:19 · 443 阅读 · 0 评论 -
【题解】LightOJ1220 Mysterious Bacteria 线性筛+唯一分解定理+最大公约数
DescriptionDr. Mob has just discovered a Deathly Bacteria. He named it RC-01. RC-01 has a very strange reproduction system. RC-01 lives exactly x days. Now RC-01 produces exactly p new deadly Bacter...原创 2018-09-15 06:35:01 · 200 阅读 · 0 评论 -
【题解】LightOJ1215 Finding LCM 最大公约数
题目链接DescriptionLCM is an abbreviation used for Least Common Multiple in Mathematics. We say LCM (a, b, c) = L if and only if L is the least integer which is divisible by a, b and c.You will be...原创 2018-09-15 06:34:54 · 256 阅读 · 0 评论 -
【题解】LightOJ1077 How Many Points? 最大公约数
题目链接DescriptionGiven two points A and B on the X-Y plane, output the number of the lattice points on the segment AB. Note that A and B are also lattice point. Those who are confused with the defin...原创 2018-09-14 06:39:38 · 311 阅读 · 0 评论 -
【题解】洛谷P1072(同CH3201/LibreOJ2589)[NOIP2009T2] Hankson的趣味题 线性筛+最大公约数
题目链接题目描述Hanks博士是 BT(Bio-Tech,生物技术) 领域的知名专家,他的儿子名叫 Hankson。现在,刚刚放学回家的 Hankson正在思考一个有趣的问题。今天在课堂上,老师讲解了如何求两个正整数c1和c2的最大公约数和最小公倍数。现在 Hankson 认为自己已经熟练地掌握了这些知识,他开始思考一个“求公约数”和“求公倍数”之类问题的“逆问题”,这个问题是这样...原创 2018-09-11 13:37:42 · 318 阅读 · 0 评论 -
【题解】洛谷P1029最大公约数和最小公倍数问题[NOIP2001普及] 最大公约数+枚举
题目链接题目描述输入2个正整数x0,y0 (2≤x0 <100000,2≤y0<=1000000),求出满足下列条件的P,Q的个数条件:P,Q是正整数要求P,Q以x0为最大公约数,以y0为最小公倍数.试求:满足条件的所有可能的2个正整数的个数.输入输出格式输入格式: 2个正整数x0,y0 输出格式: 1个数,表示求出满足条件的P,Q的...原创 2018-09-18 10:42:09 · 619 阅读 · 0 评论 -
【题解】codeforces1047C[Codeforces Round #511 (Div. 2)]C.Enlarge GCD 最大公约数
DescriptionMr. F has n positive integers, a1,a2,…,an.He thinks the greatest common divisor of these integers is too small. So he wants to enlarge it by removing some of the integers.But this proble...原创 2018-09-30 15:01:56 · 269 阅读 · 0 评论