blob: fdf7e5c55f4814fd086546fb96490d569cf02727 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#!/usr/bin/env python
from itertools import permutations
def check_resution(arr):
a, b, c, d, e = arr
return a + b * c**2 + d**3 - e == 399
if __name__ == "__main__":
coins = {2: "red", 3: "corroded", 5: "shiny", 7: "concave", 9: "blue"}
res = next(i for i in permutations(coins.keys(), len(coins)) if check_resution(i))
print("order: " + ", ".join([coins[i] for i in res]))
print("({} + {}*{}^2 + {}^3 - {} = 399)".format(*res))
|