#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <set>
#include <string.h>
using namespace std;
//int map[1025][1025];
int ans[1025][1025];
struct Point {
int x;
int y;
int cl;
Point(int x_,int y_,int cl_):x(x_),y(y_),cl(cl_){}
};
int F(int m, int n) {
if (n > m) {
int temp = m;
m = n;
n = temp;
}
if (m%n == 0)
return n;
else {
return F(m%n, n);
}
}
int main()
{
int M, N;
while(cin >> M >> N) {
cout << F(M, N) << endl;
}
return 0;
}
[Coursera]算法基础_Week9_考试_Q2
最新推荐文章于 2020-08-09 15:44:02 发布