結果 : dynamic programming and greedy algorithm