凭记忆写的第三题答案:
https://www.nowcoder.com/discuss/246736