本文整理汇总了Python中jas.Ring.gcd方法的典型用法代码示例。如果您正苦于以下问题:Python Ring.gcd方法的具体用法?Python Ring.gcd怎么用?Python Ring.gcd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jas.Ring
的用法示例。
在下文中一共展示了Ring.gcd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cmp
# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gcd [as 别名]
print "a = ", a;
print "b = ", b;
print "c = ", c;
print "f = ", f;
print;
ac = a * c;
bc = b * c;
print "ac = ", ac;
print "bc = ", bc;
print;
t = System.currentTimeMillis();
g = r.gcd(ac,bc);
t = System.currentTimeMillis() - t;
print "g = ", g;
#print "gcd time =", t, "milliseconds";
d = r.gcd(g,c);
if cmp(c,d) == 0:
print "gcd time =", t, "milliseconds,", "isGcd(c,d): true" ;
else:
print "gcd time =", t, "milliseconds,", "isGcd(c,d): ", cmp(c,d);
print;
#d = g / c;
#m = g % c;
#print "d = ", d;
#print "m = ", m;
示例2: str
# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gcd [as 别名]
print "a = ", a;
print "b = ", b;
print "c = ", c;
print;
ac = a * c;
bc = b * c;
print "ac = ", ac;
print "bc = ", bc;
print;
t = System.currentTimeMillis();
d = r.gcd(ac,bc);
t = System.currentTimeMillis() - t;
#d = d.monic();
print "d = ", d;
m = c % d;
## print "m = ", m;
## print;
if m.isZERO():
print "gcd time =", t, "milliseconds,", "isGcd(c,d): true" ;
else:
print "gcd time =", t, "milliseconds,", "isGcd(c,d): ", str(m);
print;