__gcd()

在翻别人的题解的时候偶然发现了这个函数,然后就去查了查,但是相关内容不多,__gcd(x,y);好像是GNU的内部函数,不是一个标准库里的函数,我也不太了解,平时写题直接用这个函数挺方便的,当然也可以手写gcd函数,它头文件是<algorithm>


#include <iostream>
#include <algorithm>
using namespace std;
int a,b;

int main()
{
  cin>>a>>b;
  cout<<__gcd(a,b)<<endl;
  return 0;
}


原博客:https://blog.csdn.net/charles_zaqdt/article/details/80944060

猜你喜欢

转载自blog.csdn.net/qq_16554583/article/details/81041604
gcd