solve the question http://sdau.openjudge.cn/c/003/