Dynamic Programming

www.spoj.com/problems/MBALL