Vote count:
0
CutPrices=[(1,5),(2,6),(3,2)]
CutPrices=sorted(CutPrices)
RodLength=int(input("Enter Rod Length =>"))
def CutRod(p, n):
if n == 0:
return 0
q =float(-inf)
for i in range(1,n+1):
q = max(q, p[i-1][1] + CutRod(p, n-p[i-1][0])
return q
print(CutRod(CutPrices,RodLength))
asked 23 secs ago
Why is this giving a syntax error?
Aucun commentaire:
Enregistrer un commentaire