Description

One day Vasya was sitting on a not so interesting Maths lesson and making an origami from a rectangular a mm  × b mm sheet of paper (a > b). Usually the first step in making an origami is making a square piece of paper from the rectangular sheet by folding the sheet along the bisector of the right angle, and cutting the excess part.

After making a paper ship from the square piece, Vasya looked on the remaining (a - b) mm  × b mm strip of paper. He got the idea to use this strip of paper in the same way to make an origami, and then use the remainder (if it exists) and so on. At the moment when he is left with a square piece of paper, he will make the last ship from it and stop.

Can you determine how many ships Vasya will make during the lesson?

Input

The first line of the input contains two integers ab (1 ≤ b < a ≤ 1012) — the sizes of the original sheet of paper.

Output

Print a single integer — the number of ships that Vasya will make.

Sample Input

Input
2 1

Output
2

Input
10 7

Output
6

Input
1000000000000 1

Output
1000000000000

Hint

Pictures to the first and second sample test.

题目大意:给一个长方形,看能折出多少个正方形。

题目链接:http://codeforces.com/problemset/problem/527/A

源代码:

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<stdlib.h>
#include<set>
#include<cstring>
#include<queue>
using namespace std;
__int64 ans=0;
int main()
{__int64 a,b;scanf("%I64d%I64d",&a,&b);while(a != b){if(a<b){__int64 t = a;a = b;b = t;}__int64 p;p = a / b;ans += p;a = a - b*p;if(a == 0){break;}if(p == 0){ans++;}}printf("%I64d\n",ans);return 0;
}


A-Playing with Paper相关推荐

  1. codeforces 527A Playing with Paper

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

  2. [codeforces] 527A Playing with Paper

    原题 简单的gcd #include<cstdio> #include<algorithm> typedef long long ll; using namespace std ...

  3. 【codeforces 527A】Playing with Paper

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

  4. Codeforces Round #296 (Div. 2)

    第一次做CF,唉,还是基础的东西做的太少,练得不够. A.Playing with Paper 一个折纸游戏,大概意思就是从一个矩形中最多能切割出多少个大小可以不等的正方形. 已知长和宽a,b,不停地 ...

  5. CVPR 2011 全部论文标题和摘要

    CVPR 2011 Tian, Yuandong; Narasimhan, Srinivasa G.; , ■Rectification and 3D reconstruction of curved ...

  6. Paper Reading 1 - Playing Atari with Deep Reinforcement Learning

    来源:NIPS 2013 作者:DeepMind 理解基础: 增强学习基本知识 深度学习 特别是卷积神经网络的基本知识 创新点:第一个将深度学习模型与增强学习结合在一起从而成功地直接从高维的输入学习控 ...

  7. Paper:《NÜWA: Visual Synthesis Pre-training for Neural visUal World creAtion,女娲:用于神经视觉世界创造的视觉》翻译与解读

    Paper:<NÜWA: Visual Synthesis Pre-training for Neural visUal World creAtion,女娲:用于神经视觉世界创造的视觉>翻 ...

  8. 论文笔记之:Playing for Data: Ground Truth from Computer Games

    Playing for Data: Ground Truth from Computer Games ECCV 2016 Project Page:http://download.visinf.tu- ...

  9. DQN paper 总结

    已读paper Playing Atari with Deep Reinforcement Learning Human-level control through deep reinforcemen ...

  10. ICLR2020国际会议焦点论文(Spotlight Paper)列表(内含论文源码)

    来源:AINLPer微信公众号(点击了解一下吧) 编辑: ShuYini 校稿: ShuYini 时间: 2020-02-21     2020年的ICLR会议将于今年的4月26日-4月30日在Mil ...

最新文章

  1. plt.figure(figsize(x,y))设置后后续程序都跟着改变,如何处理?走破解它!
  2. 每天一个linux命令(6):rmdir 命令
  3. epel源mysql版本_linux增加epel源,yum安装nignx,脚本安装mysql服务端,shell脚本监控网站页面...
  4. MYECLIPSE中快速解决项目的错误的方法
  5. 虾皮如何注册店铺_虾皮跨境电商怎样注册店铺?做(shopee)虾皮电商靠谱吗
  6. js代码赋值触发select控件的onchange事件
  7. latex设置一级标题样式不居中_Markdown不快速入门
  8. 乐迪机器人正确操作_乐迪智能早教机器人好用吗 乐迪智能早教机器人使用测评...
  9. 三菱GXWorks2 程序仿真功能
  10. 弹窗php整人_PHP控制前台弹出对话框的实现方法
  11. 美国白宫《国家人工智能研究发展战略计划》
  12. Refresh Token介绍
  13. Apache安装apr和apr-util作用
  14. gee微端服务器系统设置,Gee引擎微端服务器
  15. 回味宋朝——文化的盛世
  16. 1秒钟组装发动机,我震惊了
  17. 安卓开发常用icon/png图样
  18. python字母对应序号_python获取字母在字母表对应位置的几种方法及性能对比较
  19. WIN32_FIND_DATA、FILETIME、FindFirstFile对文件的操作
  20. 多测师肖sir_高级讲师_第2个月第33讲解jenkins

热门文章

  1. 重磅综述:精神分裂症的神经影像生物标志物
  2. 中国跨境平台出海,产业带依然是最大优势
  3. 鸿蒙系统是手机系统还是电脑系统,鸿蒙系统能兼容手机电脑和智能设备,这是怎样实现的?...
  4. 完整登录、注册页面(无功能)
  5. 各类型PPT免费模板,无需编辑直接套用即可!
  6. Linux远程管理常用命令(超全超详细)【持续更新】
  7. 贝塞尔曲线轨迹运动原理与实战
  8. buu firmware
  9. 小米手机权限开启方法9
  10. 面经:阿里二面自我剖析---Java岗(50分钟)