[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;
}
[codeforces] 527A Playing with Paper的更多相关文章
- 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 ...
- CF Playing with Paper
Playing with Paper time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- 【codeforces 527A】Playing with Paper
[题目链接]:http://codeforces.com/contest/527/problem/A [题意] 让你每次从一个长方形里面截出一个边长为长方形的较短边的正方形; 然后留下的部分重复上述步 ...
- 水题 Codeforces Round #296 (Div. 2) A. Playing with Paper
题目传送门 /* 水题 a或b成倍的减 */ #include <cstdio> #include <iostream> #include <algorithm> ...
- CodeForces 176C Playing with Superglue 博弈论
Playing with Superglue 题目连接: http://codeforces.com/problemset/problem/176/C Description Two players ...
- Codeforces 1079C Playing Piano(记忆化搜索)
题目链接:Playing Piano 题意:给定长度为n的序列$a_i$,要求得到同样长度的序列$b_i$.满足一下条件: if $a_i < a_{i+1}$ then $b_i < b ...
- CF527A:Playing with Paper——题解
https://vjudge.net/problem/CodeForces-527A http://codeforces.com/problemset/problem/527/A 题目大意:一个纸长a ...
- A. Playing with Paper
这是Codeforces Round #296 (Div. 2)的A题,题意就是: 小明有一张长为a,宽为b的纸,每当要折纸鹤时,就从纸上剪下一个正方形,然后,剩下的纸还可以剪出正方形,要是剩下的纸刚 ...
- codeforces 305E Playing with String
刚开始你只有一个字符串每次能选择一个有的字符串s,找到i,满足s[i - 1] = s[i + 1],将其分裂成3 个字符串s[1 ·· i - 1]; s[i]; s[i + 1 ·· |s|] ...
随机推荐
- ref是什么?
ref是组件的特殊属性,组件被渲染后,指向组件的一个引用.可以通过组件的ref属性,来获取真实的组件. 因为,组件并不是真正的DOM节点,而是存在于内存中的一种数据结构,称为虚拟的DOM,只有当它真正 ...
- django+xadmin在线教育平台(十二)
6-4 用form实现登录-1 上面我们的用户登录的方法是基于函数来做的.本节我们做一个基于类方法的版本. 要求对类的继承有了解. 基础教程中基本上都是基于函数来做的,其实更推荐基于类来做.基于类可以 ...
- 搭建Maven私有仓库
Nexus官网下载:Nexus Repository Manager OSS :https://www.sonatype.com/download-oss-sonatype 1.解压 $ tar -z ...
- 第三章习题 C++ Primer 第六版
1.使用一个整数输入自己的身高(单位为cm),并将此身高转化为米和厘米共同表示的形式,使用下划线字符来指示输入的位置,使用一个const符号常量来表示转换因子. #include<iostrea ...
- Spring的注解@Qualifier
近期在捯饬spring的注解,现将遇到的问题记录下来,以供遇到同样问题的童鞋解决~ 先说明下场景,代码如下: 有如下接口: public interface EmployeeService { pub ...
- 笔记-scrapy-item
笔记-scrapy-item 1.总述 爬虫数据保存用,一般情况下无需过多处理,引用并使用Field方法即可. 2.使用 常规使用: import scrapy class Product(scrap ...
- 13 Django组件-cookie与session
会话跟踪技术 1 什么是会话跟踪技术 我们需要先了解一下什么是会话!可以把会话理解为客户端与服务器之间的一次会晤,在一次会晤中可能会包含多次请求和响应.例如你给10086打个电话,你就是客户端,而10 ...
- laravel5.5路由
目录 1. routes/web.php 2. routes/api.php 3. 重定向路由 4. 路由参数 5. 约束 6. 命名路由 7. 路由组 8 路由模型绑定 9 表单方法伪造 10 访问 ...
- 【vim环境配置】详细实录
[写在前面] 以下的所有内容主要参照: https://github.com/yangyangwithgnu/use_vim_as_ide . 原blog作者写的非常用心,建议大家都去看看.(个人觉得 ...
- glup自动化构建工具
实现的功能包括 js压缩,css文件合并压缩并在html加版本号,压缩html文件 1.安装gulp 建议参考官网就行http://www.gulpjs.com.cn/docs/getting-sta ...