题目链接:codeforces527A
不能纯暴力,用a/b。
#define _CRT_SECURE_NO_DEPRECATE
#include<stdio.h>
#include<algorithm>
using namespace std;
void swap(int a, int b){
if (a < b){
int t = a; a = b; b = t;
}
}
int main(){
long long int a, b;
while (scanf("%lld %lld", &a, &b) != EOF){
long long int ans = 0;
swap(a, b);
while (a % b){
ans += a / b;
long long int t = a;
a = b;
b = t % b;
}
ans += a / b;
printf("%lld\n", ans);
}
return 0;
}