Part of the answer to the 4th ACM Programming Contest of Henan Province.