Problem Description Given two positive integers a and b,find suitable X and Y to meet the conditions:                                                        X+Y=a                                              Least Common Multiple (X, Y) =b   InputInp…
传送门 •题意 一直整数$a,b$,有 $\left\{\begin{matrix}x+y=a\\ LCM(x*y)=b \end{matrix}\right.$ 求$x,y$ •思路 解题重点:若$gcd(p,q)=1$,则$gcd(p+q,pq)=1$ 设$gcd(x,y)=g$,令$p=\frac{x}{g},q=\frac{y}{g}$,$p,q$互素 则$\left\{\begin{matrix}x+y=p*g+q*g=(p+q)g=a\\ LCM(x,y)=\frac{xy}{g}=…
A Simple Math Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1645    Accepted Submission(s): 468 Problem Description Given two positive integers a and b,find suitable X and Y to meet th…
给大一的排位赛中数论的一题.好吧不会做...提供一个题解吧:http://blog.csdn.net/aozil_yang/article/details/53538854. 又学了一个新的公式..如果x和y互质,那么x+y和x*y互质.证明如下:随便找一个x中有的因子c,因为x,y互质,因此c不是y的因子.同时c是x*y的因子,由同余模方程知(x+y)% c = x % c + y % c = 0 + y % c.因为c不是y的因子,所以不等于0,所以c不是x+y的因子.同理可以证得x和y中的…
题目描述: Given two positive integers a and b,find suitable X and Y to meet the conditions: X+Y=a Least Common Multiple (X, Y) =b Input Input includes multiple sets of test data.Each test data occupies one line,including two positive integers a(1≤a≤2*10^…
http://acm.hdu.edu.cn/showproblem.php?pid=5974 遇到数学题真的跪.. 题目要求 X + Y = a lcm(X, Y) = b 设c = gcd(x, y); 那么可以表达出x和y了,就是x = i * c; y = j * c; 其中i和j是互质的. 所以lcm(x, y) = i * j * c = b 那么就得到两个方程了. i * c + j * c = a; i * j * c = b; 但是有一个c,三个未知数. 因为i和j互质,所以(i…
Problem Description Given two positive integers a and b,find suitable X and Y to meet the conditions: X+Y=a Least Common Multiple (X, Y) =b   Input Input includes multiple sets of test data.Each test data occupies one line,including two positive inte…
题意:给定a和b,求一组满足x+y=a && lcm(x, y)=b. 析:x+y = a, lcm(x, y) = b,=>x + y = a, x * y = b * k,其中 k = gcd(x, y). 然后第一个式子同时除以k,第二个式子同时除以k*k,那么x/k,和y/k是互质的,那么a/k和b/k也是互质的.所以问题就转化成了 x' + y' = a',x' * y' = b'.然后解方程并判断解的存在即可. 代码如下: #pragma comment(linker,…
题目链接 题意 现有\[x+y=a\\lcm(x,y)=b\]找出满足条件的正整数\(x,y\). \(a\leq 2e5,b\leq 1e9,数据组数12W\). 思路 结论 \(gcd(x,y)=gcd((x+y),lcm(x,y))\) 证明 先证\(gcd(x,y)|gcd((x+y),lcm(x,y))\) 不妨设\(gcd(x,y)=k\),则有\(k\mid x,k\mid y\),则有\(k\mid (x+y)\) -① 又\(k\mid x,x\mid lcm(x,y)\),所…
传送门 •题意 已知 $a,b$,求满足 $x+y=a\ ,\ LCM(x,y)=b$ 条件的 $x,y$: 其中,$a,b$ 为正整数,$x,y$ 为整数: •题解 关键式子:设 $a,b$ 为正整数,如果有 $GCD(a,b)=1$,则有 $GCD(a+b,ab)=1$: 证明可以看这里[…