A-Playing with Paper
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 a, b (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
2 1
2
10 7
6
1000000000000 1
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相关推荐
- codeforces 527A Playing with Paper
A. Playing with Paper time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- [codeforces] 527A Playing with Paper
原题 简单的gcd #include<cstdio> #include<algorithm> typedef long long ll; using namespace std ...
- 【codeforces 527A】Playing with Paper
[题目链接]:http://codeforces.com/contest/527/problem/A [题意] 让你每次从一个长方形里面截出一个边长为长方形的较短边的正方形; 然后留下的部分重复上述步 ...
- Codeforces Round #296 (Div. 2)
第一次做CF,唉,还是基础的东西做的太少,练得不够. A.Playing with Paper 一个折纸游戏,大概意思就是从一个矩形中最多能切割出多少个大小可以不等的正方形. 已知长和宽a,b,不停地 ...
- CVPR 2011 全部论文标题和摘要
CVPR 2011 Tian, Yuandong; Narasimhan, Srinivasa G.; , ■Rectification and 3D reconstruction of curved ...
- Paper Reading 1 - Playing Atari with Deep Reinforcement Learning
来源:NIPS 2013 作者:DeepMind 理解基础: 增强学习基本知识 深度学习 特别是卷积神经网络的基本知识 创新点:第一个将深度学习模型与增强学习结合在一起从而成功地直接从高维的输入学习控 ...
- Paper:《NÜWA: Visual Synthesis Pre-training for Neural visUal World creAtion,女娲:用于神经视觉世界创造的视觉》翻译与解读
Paper:<NÜWA: Visual Synthesis Pre-training for Neural visUal World creAtion,女娲:用于神经视觉世界创造的视觉>翻 ...
- 论文笔记之:Playing for Data: Ground Truth from Computer Games
Playing for Data: Ground Truth from Computer Games ECCV 2016 Project Page:http://download.visinf.tu- ...
- DQN paper 总结
已读paper Playing Atari with Deep Reinforcement Learning Human-level control through deep reinforcemen ...
- ICLR2020国际会议焦点论文(Spotlight Paper)列表(内含论文源码)
来源:AINLPer微信公众号(点击了解一下吧) 编辑: ShuYini 校稿: ShuYini 时间: 2020-02-21 2020年的ICLR会议将于今年的4月26日-4月30日在Mil ...
最新文章
- plt.figure(figsize(x,y))设置后后续程序都跟着改变,如何处理?走破解它!
- 每天一个linux命令(6):rmdir 命令
- epel源mysql版本_linux增加epel源,yum安装nignx,脚本安装mysql服务端,shell脚本监控网站页面...
- MYECLIPSE中快速解决项目的错误的方法
- 虾皮如何注册店铺_虾皮跨境电商怎样注册店铺?做(shopee)虾皮电商靠谱吗
- js代码赋值触发select控件的onchange事件
- latex设置一级标题样式不居中_Markdown不快速入门
- 乐迪机器人正确操作_乐迪智能早教机器人好用吗 乐迪智能早教机器人使用测评...
- 三菱GXWorks2 程序仿真功能
- 弹窗php整人_PHP控制前台弹出对话框的实现方法
- 美国白宫《国家人工智能研究发展战略计划》
- Refresh Token介绍
- Apache安装apr和apr-util作用
- gee微端服务器系统设置,Gee引擎微端服务器
- 回味宋朝——文化的盛世
- 1秒钟组装发动机,我震惊了
- 安卓开发常用icon/png图样
- python字母对应序号_python获取字母在字母表对应位置的几种方法及性能对比较
- WIN32_FIND_DATA、FILETIME、FindFirstFile对文件的操作
- 多测师肖sir_高级讲师_第2个月第33讲解jenkins