Sichuan University Programming Contest 2007 Final

G: Generous King