Lessons
C++ · Algorithm Techniques · 42. Greedy
step 1 of 7
Biggest coin first
Greedy means: grab what looks best right now, and never look back.
To pay 680 tg, I take the biggest coin that still fits. Again and again.
Mission
Make me pay 970 tg instead. How many coins now?
PIP·1
main.cppyour code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
← press me!
Press RUN to see what this program does.