原题

简单的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;
}

[codeforces] 527A Playing with Paper的更多相关文章

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

    A. Playing with Paper One day Vasya was sitting on a not so interesting Maths lesson and making an o ...

  2. CF Playing with Paper

    Playing with Paper time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  3. 【codeforces 527A】Playing with Paper

    [题目链接]:http://codeforces.com/contest/527/problem/A [题意] 让你每次从一个长方形里面截出一个边长为长方形的较短边的正方形; 然后留下的部分重复上述步 ...

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

    题目传送门 /* 水题 a或b成倍的减 */ #include <cstdio> #include <iostream> #include <algorithm> ...

  5. CodeForces 176C Playing with Superglue 博弈论

    Playing with Superglue 题目连接: http://codeforces.com/problemset/problem/176/C Description Two players ...

  6. Codeforces 1079C Playing Piano(记忆化搜索)

    题目链接:Playing Piano 题意:给定长度为n的序列$a_i$,要求得到同样长度的序列$b_i$.满足一下条件: if $a_i < a_{i+1}$ then $b_i < b ...

  7. CF527A:Playing with Paper——题解

    https://vjudge.net/problem/CodeForces-527A http://codeforces.com/problemset/problem/527/A 题目大意:一个纸长a ...

  8. A. Playing with Paper

    这是Codeforces Round #296 (Div. 2)的A题,题意就是: 小明有一张长为a,宽为b的纸,每当要折纸鹤时,就从纸上剪下一个正方形,然后,剩下的纸还可以剪出正方形,要是剩下的纸刚 ...

  9. codeforces 305E Playing with String

    刚开始你只有一个字符串每次能选择一个有的字符串s,找到i,满足s[i - 1] = s[i + 1],将其分裂成3 个字符串s[1 ··  i - 1]; s[i]; s[i + 1 ·· |s|] ...

随机推荐

  1. tp3.2 excel导出

    //导出操作 function exportExcel($expTitle,$expCellName,$expTableData,$names,$width){ $xlsTitle = iconv(' ...

  2. tcp回显客户端发送的数据

    客户端: import socket tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) tcp_socket.connect ...

  3. 用python画小猪佩奇(非原创)

    略作改动: # coding:utf-8 import turtle as t t.screensize(400, 300, "blue") t.pensize(4) # 设置画笔 ...

  4. JavaScript对象回收机制

    js维护了一张对象引用表: 当一个对象被创建以后,栈内就有一个a,a这个对象就指向了对这个地址,当a=new Person()执行后,引用次数加1.当a=null置空,引用次数减1.由系统来维护对象引 ...

  5. Matplotlib库介绍

    pyplot的plot()函数 pyplot的中文显示 pyplot的文本显示 pyplot的子绘图区域

  6. python面向对象的约束和自定义异常

    基于人为来约束: 即人为主动抛出异常 class BaseMessage(object): def send(self,x1): """ 必须继承BaseMessage, ...

  7. git 设置别名 git alias

    git config --global alias.st status git config --global alias.ck checkout git config --global alias. ...

  8. [转]全图形PPT设计指南

    三.什么时候使用 全图形PPT并不适用于所有时候,一般来说,我们在以下场合可以考虑使用:陈述一个故事.名人简介.产品介绍.读书笔记.心灵鸡汤.生活情趣等. 四.如何制作全图形PPT 全图形PPT的制作 ...

  9. web开发学习之路是否有尽头

    Linux/Git/Pip/Npm/Composer Apache/Ngnix Mysql/MongoDb/Redis PHP/Python/NodeJS javascript/jQuery/Expr ...

  10. 【Spiral Matrix II】cpp

    题目: Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. ...