Tag - dynamic programming in c