Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Unfair Dice by tabata271828
def enum(total, low, n):
if n == 1 and low <= total:
yield [total]
elif low * n < total:
for x in range(low, 1 + int(total / n)):
for y in enum(total - x, x, n - 1):
yield [x] + y
def winning_die(d):
for x in enum(sum(d), 1, len(d)):
if 0 < sum((i > j) - (i < j) for i in x for j in d):
return x
return []
Jan. 30, 2017