水题 Codeforces Round #296 (Div. 2) A. Playing with Paper

时间:2022-07-21 07:33:11

题目传送门

 /*
水题
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 ;
}