Sichuan University Programming Contest 2009 Preliminary (Single)

J: In a Line II