結果 : write greedy algorithm