modify dynamic_programming.cpp