int lcm(int a, int b) { return a / gcd(a, b) * b; } int gcd(int a,int b) { return b ? gcd(b,a%b):a; }
int exgcd(int a,int b,int &x,int &y) { if(!b) { x=1; y=0; return a; } int r=exgcd(b,a%b,x,y); int t=y; y=x-(a/b)*y; x=t; return r; //gcd }
原文地址:https://www.cnblogs.com/wronin/p/11422377.html
时间: 2024-10-03 14:39:13