[codeforces] 527A Playing with Paper
原题
简单的gcd
#include<cstdio>
#include<algorithm>
typedef long long ll;
using namespace std;
ll a,b,ans;
ll gcd(ll x,ll y)
{
if (x<y) swap(x,y);
if (y) ans+=x/y;
return !y?x:gcd(y,x%y);
}
int main()
{
scanf("%I64d%I64d",&a,&b);
if (a<b) swap(a,b);
if (a%b==0) printf("%I64d",a/b);
else gcd(a,b),printf("%I64d",ans);
return 0;
}