use dynamic programming to sovle cutting rod