My solution. Need think about DP.