Correct Change


Premium Content - Free Preview

In the Kingdom of Zumbania, the Currency printer can only print the digit 1. Thus they have 3 different denominations: 1, 11, and 111. You need to determine if you can reach a certain sum with a given set of coins.

You will be given a line of input (as an array) consisting of 4 integers for the number of 1-coins, 11-coins, 111-coins, and the desired sum.

For example, the input 1 2 3 356 means there's 1 1-coin, 2 11-coins, 3 111-coins and a desired sum of 356.


End of Free Content Preview. Please Sign in or Sign up to buy premium content.

Comments

Contact Us