#149. 砖墙制作可行性判断
砖墙制作可行性判断
Make Bricks
Background
Congcong is playing a building block game.
Problem Description
We want to make a row of bricks that is inches long. We have a number of small bricks ( inch each) and big bricks ( inches each). Return true if it is possible to make the by choosing from the given bricks. This is a little harder than it looks and can be done without any loops.
Input Format
Input is given from standard input in the following format.
smallbiggoal
Output Format
Output is printed to standard output in the following format.
result
Sample
3 1 8
true
3 1 9
false
3 2 10
true
Sample Explanation
Sample 1: small = 3, big = 1, goal = 8.
We can use big brick ( inches) and small bricks ( inches), totaling inches. So, return true.
Sample 2: small = 3, big = 1, goal = 9.
Even using all bricks, the maximum length is inches, which cannot reach inches. So, return false.
Sample 3: small = 3, big = 2, goal = 10.
We can use big bricks ( inches) and small bricks, totaling inches. So, return true.
Constraints
Time limit s, Memory limit KiB for each test case.