您的位置:首页 > 其它

Educational Codeforces Round 39 B - Weird Subtraction Process

2018-03-19 16:41 543 查看
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<stack>
#include<map>
#define PI acos(-1.0)
#define in freopen("in.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)
#define kuaidian ios::sync_with_stdio(0);

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 100 + 7, maxd = 1e5 + 7;
const int mod = 1e9 + 7;
const int INF = 0x7f7f7f7f;

ll a, b;

int main() {
kuaidian

cin >> a >> b;
int f = 1;
while(1) {
if(a == 0 || b == 0) {
break;
}
if(a >= b*2) {
a %= b*2;
} else if(b >= a*2) {
b %= a*2;
} else break;
}
cout << a << " " << b;

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐