[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…
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…
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…
[题目链接]:http://codeforces.com/contest/527/problem/A [题意] 让你每次从一个长方形里面截出一个边长为长方形的较短边的正方形; 然后留下的部分重复上述步骤; 直到剩下的部分为正方形为止; 问你一共截出了多少个正方形 [题解] 写个递归求解就好; 每次短边的边长不变; 然后答案递增长边长度/短边长度 长边的边长变为长边%短边->为0的话就改为短边长度,下一次递归结束就好; [完整代码] #include <bits/stdc++.h> usi…
题目传送门 /* 水题 a或b成倍的减 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <map> #include <set> #include <vector> #include <set&…
Playing with Superglue 题目连接: http://codeforces.com/problemset/problem/176/C Description Two players play a game. The game is played on a rectangular board with n × m squares. At the beginning of the game two different squares of the board have two ch…
题目链接:Playing Piano 题意:给定长度为n的序列$a_i$,要求得到同样长度的序列$b_i$.满足一下条件: if $a_i < a_{i+1}$ then $b_i < b_{i+1}$ if $a_i > a_{i+1}$ then $b_i > b_{i+1}$ if $a_i = a_{i+1}$ then $b_i \neq\ b_{i+1}$ $1 <= b_i <= 5$ 题解:第一个数从1-5枚举,接着从下一位开始搜索,dp[i][j]表示…
https://vjudge.net/problem/CodeForces-527A http://codeforces.com/problemset/problem/527/A 题目大意:一个纸长a,宽b.每次我们切下来最大的正方形直到剩下的纸也为正方形即停.求正方形个数. —————————— 更相减损之术的次数,用辗转相除法优化即可. #include<cstdio> #include<cstring> #include<cstdlib> #include<…
这是Codeforces Round #296 (Div. 2)的A题,题意就是: 小明有一张长为a,宽为b的纸,每当要折纸鹤时,就从纸上剪下一个正方形,然后,剩下的纸还可以剪出正方形,要是剩下的纸刚好是正方形的话,就直接拿这个正方形去做最后一个纸鹤,求总共可以折多少个纸鹤.小明是个节约资源的好孩子. _______________ input 2 1 output 2 _______________ input 10 7 output 6 _______________ 输入的2个数字分别是长…
刚开始你只有一个字符串每次能选择一个有的字符串s,找到i,满足s[i - 1] = s[i + 1],将其分裂成3 个字符串s[1 ··  i - 1]; s[i]; s[i + 1 ·· |s|] 不能操作者负,求先手必胜的一个策略初始字符串长度不超过5000 将每个字符都能操作的连续的一段作为一个游戏,状态即可表示成这一段的长度 code: #include<cstdio> #include<iostream> #include<cmath> #include<…