1 2
#!/usr/bin/env python
3 4
import itertools
5
coin_names = {9: "blue coin", 2: "red coin", 3: "corroded coin", 5: "shiny coin", 7: "concave coin"}
6 7 8 9 10 11 12 13 14 15
coins = [9, 2, 3, 5, 7] combinations = itertools.permutations(coins,len(coins)) for elem in combinations: A = elem[0] B = elem[1] C = elem[2] D = elem[3] E = elem[4] if(A + B*pow(C,2) + pow(D,3) - E == 399):
16 17 18 19 20
print coin_names[A] print coin_names[B] print coin_names[C] print coin_names[D] print coin_names[E]