「CF-527A」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 rectangular sheet by folding the sheet along the bisector of the right angle, and cutting the excess part.

链接

CF-527A

题解

直接模拟,什么都不要多想…

代码

1
2
3
4
5
6
7
#include <bits/stdc++.h>
long long a, b, q;
int main() {
for (std::cin >> a >> b; a;) a ^= b ^= a ^= b, q += a / b, a %= b;
std::cout << q;
return 0;
}
#

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×