how to solve this problem ??

Birthday Candles problem

i dont understand problem …

In this question for each case u are given the count of each candle from 0 to 9 as input. Now you have to tell the smallest integer that cannot be made using those candles. For ex:

For this case : 0 1 1 1 1 1 1 1 1 1
u have 0 candle of ‘0’ shape and 1 each of shape ‘1’ to ‘9’.
so u can make all the numbers from 1 to 9 using the candles but u cannot make 10 using the candles as u do not have the candle shapped ‘0’.

For this case : 2 2 1 2 1 1 3 1 1
in this case u have 2 candles each of shape ‘0’ and shape ‘1’ and 1 candle each of shape ‘2’,‘4’,‘5’,‘8’,‘9’
so the smallest integer u cannot make from these candles is 22 as it requires 2 candles of shape ‘2’ but we only have 1.

I hope the above answer helps!!

1 Like

this problem has an editorial (http://discuss.codechef.com/questions/4212/candle-editorial). If still you are not able to solve, the community will be happy to help you.