输入样例:
6 5 18 22
输出样例:
1
6
#include<iostream>
#include<fstream>
#include<cmath>
using namespace std;int main()
{ifstream cin("test.txt");//向OJ提交时,注释此句int m, n;while (cin >> m >> n){int large, less;large = m > n ? m : n;less = n < m ? n : m;while (less != 0){int tmp = large % less;large = less;less = tmp;}cout << large << endl;}system("pause");//向OJ提交时,注释此句return 0;
}