最大公约数(greatest common divisor,简写为gcd;或highest common factor,简写为hcf)
__gcd(x,y)是algorithm库中的函数
#include<cstdio> #include<algorithm> using namespace std; int n,m; int main() { scanf("%d %d",&n,&m); int k=__gcd(n,m);//最大公约数 printf("%d",k); return 0; }spa