Dynamic Programming
How to solve this problem: http://community.topcoder.com/stat?c=problem_statement&pm=14210
ICPC NA North Central and South Division