__gcd()函数是内置于algorithm头文件中的函数,主要是用于求两个数的最大公约数,这是这个函数主要是这个功能:ios
下面是代码十分简单函数
#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> using namespace std; int main() { int a,b; cin>>a>>b; cout<<__gcd(a,b)<<endl; return 0; }