(如果你经常看 Codeforces 的官方题解,或是一些外国教材、论文等,你会发现 "observation" 这个词出现得很频繁。很多时候,当结论或是推论并不是那么显而易见时,切中要害的 observation 就非常关键!) Observation 1:lcm(ai,ai+1)|bi+1 由题目要求得ai=gcd(bi,bi+1),ai+1=gcd(bi+1,bi+2), 注意到bi+1...
[codeforces] 527A Playing with Paper 原题 简单的gcd #include<cstdio>#include<algorithm>typedeflonglongll;usingnamespacestd; ll a,b,ans;llgcd(ll x,ll y){if(x<y)swap(x,y);if(y) ans+=x/y;return!y?x:gcd(y,x%y); }intmain(){scanf("%I64d%I64d",&a,&b);if(a...
CodeForces Algorithms. Contribute to DionysiosB/CodeForces development by creating an account on GitHub.
1368B-CodeforcesSubsequences.cpp 1368C-EvenPicture.cpp 1369A-FashionabLee.cpp 1369B-AccurateLee.cpp 1369C-RationalLee.cpp 1370A-1370A-MaximumGCD.cpp 1370B-GCDCompression.cpp 1370C-NumberGame.cpp 1371A-MagicalSticks.cpp 1371B-MagicalCalendar.cpp 1371C-ACookieForYou.cpp 1371D-Grid00100.cpp 1372A...
CF527A:Playing with Paper——题解 https://vjudge.net/problem/CodeForces-527A http://codeforces.com/problemset/problem/527/A 题目大意:一个纸长a,宽b。每次我们切下来最大的正方形直到剩下的纸也为正方形即停。求正方形个数。 ——— 更相减损之术的...
(a - b) mm × bmm 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 ...