int gcd(int a,int b){ //辗转相除法,《欧几里得公式》求最大公因数 return b>0?gcd(b,a%b):a; } int lcm(int a,int b){ return a*b/gcd(a,b); }