some algorithm problem in hihocoder.com