题目:http://acm.hdu.edu.cn/showproblem.php?pid=1728 https://www.cnblogs.com/qiufeihai/archive/2012/08/27/2659159.html