NC16691:最大公约数和最小公倍数问题[python][暴力枚举]
最大公约数和最小公倍数问题
http://www.nowcoder.com/questionTerminal/afd6a1810134413fa214ee8d0622a554
暴力枚举可过:
# a*b = x0 * y0 import math x0, y0 = map(int, input().split()) a_b = x0 * y0 cnt = 0 for i in range(2, a_b): j, j_y = divmod(a_b, i) if j_y == 0 and math.gcd(i, j) == x0: cnt += 1 print(cnt)