from math import log
def compare_powers(n1, n2):
return cmp(log(n2[0])*n2[1], log(n1[0])*n1[1])
def compare_powers((x, a), (y, b)):
return cmp(b*log(y), a*log(x))
from math import log
def compare_powers(n1, n2):
(x, a), (y, b) = n1, n2
return cmp(b*log(y), a*log(x))
def compare_powers(n1,n2):
from math import log
return -cmp(n1[1]*log(n1[0]), n2[1]*log(n2[0]))
from math import log
def compare_powers((x, a), (y, b)):
return cmp(b*log(y), a*log(x))
from math import log
def compare_powers(n1, n2):
val = n2[1] * log(n2[0]) - n1[1] * log(n1[0])
return -1 if val < 0 else 1 if val > 0 else 0
from math import log
def compare(x, y):
if x == y:
return 0
if x < y:
return 1
if x > y:
return -1
def compare_powers(x, y):
a, c = x
b, d = y
x = (c * log(a)) / log(2)
y = (d * log(b)) / log(2)
return compare(x, y)
from math import log
def compare_powers((n1, p1), (n2, p2)):
return cmp(p2 * log(n2), p1 * log(n1))
from math import log
def compare_powers(n1,n2):
if n2[1]*log(n2[0]) > n1[1]*log(n1[0]): return 1
elif n2[1]*log(n2[0]) < n1[1]*log(n1[0]): return -1
else: return 0
from math import log
def compare_powers(n1,n2):
return cmp(n2[0],1) if n1[0] == 1 else cmp(log(n2[0],n1[0])*n2[1],n1[1])
import math
def cmp(a, b):
return (a < b) - (a > b)
def compare_powers(n1,n2):
x_base, x_power = n1
y_base, y_power = n2
if x_power > y_power:
y_power = y_power / (x_power/2)
x_power = 2
else:
x_power = x_power / (y_power/2)
y_power = 2
return cmp(x_base ** x_power, y_base ** y_power)
import math
def compare_powers(n1,n2):
res1 = n1[1] * math.log(n1[0])
res2 = n2[1] * math.log(n2[0])
return -1 if res1 > res2 else 0 if res1 == res2 else 1
景越Python基础训练营QQ群