/*
水题
a或b成倍的减
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <set>
using namespace std; const int MAXN = 1e6 + ;
const int INF = 0x3f3f3f3f; int main(void)
{
//freopen ("A.in", "r", stdin); long long a, b; while (~scanf ("%I64d%I64d", &a, &b))
{
long long cnt = ;
while (a != b && a!= && b!=)
{
if (a > b)
{
long long x = a / b;
cnt += x;
a -= x * b; }
else if (a < b)
{
long long x = b / a;
cnt += x;
b -= a * x;
}
} printf ("%I64d\n", cnt-);
} return ;
}
相关文章
- Codeforces Round #520 (Div. 2) A. A Prank 好题
- codeforces水题100道 第十二题 Codeforces Beta Round #91 (Div. 2 Only) A. Lucky Division (brute force)
- Codeforces Round #371 (Div. 2) C. Sonya and Queries 水题
- Codeforces Round #575 (Div. 3) D2. RGB Substring (hard version) 水题
- Codeforces Round #355 (Div. 2) B. Vanya and Food Processor 水题
- Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)
- Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题
- Codeforces Round #290 (Div. 2) A. Fox And Snake 水题
- Codeforces Round #368 (Div. 2) A. Brain's Photos 水题
- Codeforces Round #386 (Div. 2)(A-E)(水题 + deque模拟 + 思维 + 构造&贪心 + set模拟)