[2010 Asia Tianjin Regional Contest Online B Problem] [HDOJ 3622]