catalog
TODO
__gcd(LL a, LL b, LL& p1, LL& p2){
if(b == 0){
p1 = 1, p2 = 0;
return a;
}
LL _gcd = __gcd(b, a%b, p2, p1);
' [a - (a/b)*b] * p1 + b*p2 = _gcd] '
' a * ? = a*p1 + (a/b)*b*p1 '
' ? = p1 + (a/b)*b*p1/a ' 错!!
}
2023-10-23 19:21:52
__gcd(LL a, LL b, LL& p1, LL& p2){
if(b == 0){
p1 = 1, p2 = 0;
return a;
}
LL _gcd = __gcd(b, a%b, p2, p1);
' [a - (a/b)*b] * p1 + b*p2 = _gcd] '
' a * ? = a*p1 + (a/b)*b*p1 '
' ? = p1 + (a/b)*b*p1/a ' 错!!
}
下一篇:ALGO-1 区间k大数查询