The fifth question's solution. But there are some problems I didn't solve.