def bottom_up_cut_rod(p,n): i=0 r=[0]*(n+1) for j in range(1,n+1): q=-1 for i in range(1,j+1): q=max(q,p[i]+r[j-i]) r[j]=q return r[n]
def bottom_up_cut_rod(p,n): i=0 r=[0]*(n+1) for j in range(1,n+1): q=-1 for i in range(1,j+1): q=max(q,p[i]+r[j-i]) r[j]=q return r[n]