__gcd-最大公約數

__gcd-最大公約數函數

  1. 最大公約數(greatest common divisor,簡寫爲gcd;或highest common factor,簡寫爲hcf)
  2. __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

相關文章
相關標籤/搜索