动态规划
P = 60
D1 = 0.95
D2 = 0.9
D3 = 0.85
X = 5
Y = 1
Z = 1
init = P*(X+Y+Z)*D1
minP = [[[init]*(Z+1) for y in range(Y+1)] for x in range(X+1)]
minP[1][0][0]=minP[0][1][0]=minP[0][0][1]=P*D1
minP[1][1][0]=minP[0][1][1]=minP[1][0][1]=P*2*D2
minP[1][1][1]=P*3*D3
for i in range(1, X+1):
for j in range(1, Y+1):
for k in range(1, Z+1):
if (i==j==k==1):
continue
minP[i][j][k] = min(P*D1 + minP[i-1][j][k],
P*D1 + minP[i][j-1][k],
P*D1 + minP[i][j][k-1],
P*2*D2 + minP[i-1][j-1][k],
P*2*D2 + minP[i][j-1][k-1],
P*2*D2 + minP[i-1][j][k-1],
P*3*D3 + minP[i-1][j-1][k-1])
# print minP
print 'Min Price is %d' % minP[X][Y][Z]