ASC7 Problem I. Bishops on a Toral Board

题目大意

给你一个左右卷起来,上下卷起来的$n imes m$的棋盘,问至少需要多少个bishop可以控制所有的格子。

简要题解

$gcd(n,m)$

python大法好

1 def gcd(x, y):
2     if y == 0:
3         return x
4     return gcd(y, x % y)
5 a, b = map((int), open("toral.in", "r").read().split(' '))
6 open("toral.out", "w").write(str(gcd(a, b)))
原文地址:https://www.cnblogs.com/ichn/p/6406654.html