一、数论算法
1.求两数的最大公约数
import sys def gcd(p, q): if q == 0: return p return gcd(q, p%q) def main(): p = int(sys.argv[1]) q = int(sys.argv[2]) print(gcd(p, q)) if __name__ == ‘__main__‘: main()
标签:== gpo return 最大 ret name def log imp
import sys def gcd(p, q): if q == 0: return p return gcd(q, p%q) def main(): p = int(sys.argv[1]) q = int(sys.argv[2]) print(gcd(p, q)) if __name__ == ‘__main__‘: main()
标签:== gpo return 最大 ret name def log imp
原文地址:https://www.cnblogs.com/mocuishle/p/8476632.html