This is only my exercise.贪心算法