Konjac accidentally found out that the gcd that I have a headache has a ready-made function - " __gcd(x,y) "
First, the dry goods,
__gcd(x,y) is a function in the algorithm library
, Well, the only answer on Baidu about which library it belongs to is from me.
However, this function does not seem to be so simple. It seems that the compiler comes with #@! *¥~…
Next, let's cite Baidu.
Really bald, let's see an example below.
#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;
}
ps In order to prove that it is not a function of the iostream library, I specifically removed the iostream call.