__gcd()函數基本用法

__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;
} 
相關文章
相關標籤/搜索