LL extgcd(LL a,LL b,LL &x,LL &y){
LL ret = a;
if(b){
ret = extgcd(b,a%b,y,x);
y -= (a/b)*x;
}else{
x = 1;
y = 0;
}
return ret;
}
扩展欧几里得
最新推荐文章于 2025-04-14 17:25:35 发布
LL extgcd(LL a,LL b,LL &x,LL &y){
LL ret = a;
if(b){
ret = extgcd(b,a%b,y,x);
y -= (a/b)*x;
}else{
x = 1;
y = 0;
}
return ret;
}