ASC7 Problem I. Bishops on a Toral Board

题目大意

给你一个左右卷起来,上下卷起来的$n\times 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)))

 

posted @ 2017-02-16 17:14  ichneumon  阅读(182)  评论(0)    收藏  举报