修改后的完美解法:
https://www.nowcoder.com/discuss/59867