solve hw5_1 and hw5_2