c++中求最大公约数函数

在头文件algorithm中的 __gcd(a,b) 函数。

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	printf("%d",__gcd(a,b));
	return 0;
}
Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐