Loading...
Loading...
Loading...
A ticket machine accepts coins of some values and has as many coins of each value as needed. Print YES if the exact amount can be paid and NO if it cannot.
Example 1
Input
2 5 11
Output
YES
2 + 2 + 2 + 5 = 11.
Example 2
Input
4 6 7
Output
NO
Try the problem first. Open one hint at a time.
An amount can be paid if the amount minus some coin can be paid.
Amount 0 can always be paid.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor