[Problem]
求两个数A和B的最大公约数。 1<=A,B<=2^31-1
[Solution]
#include <iostream> using namespace std;void swap(int &a, int &b){a ^= b;b ^= a;a ^= b; }int main(){int a, b;while(cin >> a >> b){if(a > b){swap(a, b);}while(b % a != 0){b %= a;if(a > b){swap(a, b);}}cout << a << endl;}return 0; }