Skip to content

Instantly share code, notes, and snippets.

@lironsade
Created November 1, 2018 20:15
Show Gist options
  • Save lironsade/ae3b298f41792349e8987f1d10a2d749 to your computer and use it in GitHub Desktop.
Save lironsade/ae3b298f41792349e8987f1d10a2d749 to your computer and use it in GitHub Desktop.
from itertools import product
best = 0
ta = 0
tb = 0
for a,b in product(range(0,11), range(0,11)):
if (a == 0 and b == 0) or (a == 10 and b == 10):
rate = 0.5
else:
rate = 0.5 * (a/(a+b) + (10-a)/(20-a-b))
if rate > best:
ta, tb = a, b
best = rate
print("a: {}, b: {}, rate: {}".format(a,b,rate))
print("best is: {}, with a,b = {}, {}".format(best, ta, tb))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment