CF Playing with Paper】的更多相关文章

Playing with Paper time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Vasya was sitting on a not so interesting Maths lesson and making an origami from a rectangular a mm  ×  b mm she…
A. Playing with Paper 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…
题目传送门 /* 水题 a或b成倍的减 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <map> #include <set> #include <vector> #include <set&…
https://vjudge.net/problem/CodeForces-527A http://codeforces.com/problemset/problem/527/A 题目大意:一个纸长a,宽b.每次我们切下来最大的正方形直到剩下的纸也为正方形即停.求正方形个数. —————————— 更相减损之术的次数,用辗转相除法优化即可. #include<cstdio> #include<cstring> #include<cstdlib> #include<…
原题 简单的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…
这是Codeforces Round #296 (Div. 2)的A题,题意就是: 小明有一张长为a,宽为b的纸,每当要折纸鹤时,就从纸上剪下一个正方形,然后,剩下的纸还可以剪出正方形,要是剩下的纸刚好是正方形的话,就直接拿这个正方形去做最后一个纸鹤,求总共可以折多少个纸鹤.小明是个节约资源的好孩子. _______________ input 2 1 output 2 _______________ input 10 7 output 6 _______________ 输入的2个数字分别是长…
[题目链接]:http://codeforces.com/contest/527/problem/A [题意] 让你每次从一个长方形里面截出一个边长为长方形的较短边的正方形; 然后留下的部分重复上述步骤; 直到剩下的部分为正方形为止; 问你一共截出了多少个正方形 [题解] 写个递归求解就好; 每次短边的边长不变; 然后答案递增长边长度/短边长度 长边的边长变为长边%短边->为0的话就改为短边长度,下一次递归结束就好; [完整代码] #include <bits/stdc++.h> usi…
D. Block Tower time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output After too much playing on paper, Iahub has switched to computer games. The game he plays is called "Block Towers". It is…
奶昔队Round #1 热身 (奶昔队不是真正的队,是群) CodeForces 435C Cardiogram 模拟,不过我做的时候不是模拟,是计算...(写了好久,还wa了几次),现在看了别人的代码写过一份. #include <iostream> #include <algorithm> #define N 1005 using namespace std; int n,x,y,a,h,l; char ma[N<<1][N]; int main() { cin&g…
A. Playing with Paper 如果a是b的整数倍,那么将得到a/b个正方形,否则的话还会另外得到一个(b, a%b)的长方形. 时间复杂度和欧几里得算法一样. #include <iostream> #include <cstdio> using namespace std; //const int maxn = ; int main() { //freopen("in.txt", "r", stdin); ; scanf(&q…