//2009-01 输入两个数,求最大公约数
#include <iostream>
using namespace std;
void func(int a, int b)
{
if (a < b)
swap(a, b);
int d = 1;
while (d)
{
d = a % b;
a = b;
b = d;
}
cout << a << endl;
}
int main()
{
int a, b;
cin >> a >> b;
func(a, b);
return 0;
}
2009-01 hdu笔试
最新推荐文章于 2024-07-25 12:39:48 发布