結果 : algorithm for greedy method