法一: 调用algorithm的库函数 __gcd 两个下划线 法二: int GCD(int a,int b){ return b == 0 ? a : GCD(b,a%b); } 转载于:https://www.cnblogs.com/zero-begin/p/4434430.html