Birthday CandlesProblem code: CANDLE |
All submissions for this problem are available.
The chef is preparing a birthday cake for one of his guests, and his decided to write the age of the guest in candles on the cake. There are 10 types of candles, one for each of the digits '0' through '9'. The chef has forgotten the age of the guest, however, so doesn't know whether he has enough candles of the right types. For example, if the guest were 101 years old, the chef would need two '1' candles and one '0' candle. Given the candles the chef has, your task is to determine the smallest positive integer that cannot be represented with those candles.
Input:
Input will begin with an integer T?100, the number of test cases. Each test case consists of a single line with exactly 10 integers, each between 0 and 8, inclusive. The first integer of each test case represents the number of '0' candles the chef has, the second integer represents the number of '1' candles the chef has, and so on.
Output:
For each test case, output on a single line the smallest positive integer that cannot be expressed with the given candles.
Sample input:
3 2 1 1 4 0 6 3 2 2 2 0 1 1 1 1 1 1 1 1 1 2 2 1 2 1 1 3 1 1 1
Sample output:
4 10 22
| Author: | pieguy |
| Date Added: | 26-09-2010 |
| Time Limit: | 2 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments
SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:
HELP
Program should read from standard input and write to standard output. After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:
- Accepted
Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark. - Time Limit Exceeded
Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach. - Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output. - Runtime Error
Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section. - Compilation Error
Your code was unable to compile. When you see this icon, click on it for more information.
If you are still having problems, see a sample solution here.

Fetching successful submissions

i am getting tle for this
i am getting tle for this question.. i dnt see how that is possibe??.. admin is my program not giving answer for certain cases or sumthing??
please explain some more
please explain some more things
An interesting modification
An interesting modification to this problem will be to find how many of each candle type is needed to "candle write" all birthdays to let's say 150 years old.
please provide some more
please provide some more cases and some special cases.. my program works fine for the above inputs and also for some of my own inputs.. i can't figure out why i am getting wrong answer..
Admin ignore my previous
Admin ignore my previous comment I made a minor mistake!!
iI have subitted the
iI have subitted the solution, bt it says wrong answer...
while on my system it is working absolutely fine...
@admin: wt is d problem with my solution???
I didn't get how output is
I didn't get how output is coming
i'm getting a runtime error
i'm getting a runtime error here,...but i can't sort it out....please help....
the input to the problem is
the input to the problem is to be separated by spaces or not??
e.g
I'm getting wrong answer and
I'm getting wrong answer and
i m using the following
iI have subitted the
can sum1 plz tell me the
can anybdy tl me wat exactly
Admins, I tried submitting
It should be "between 0 and 9
please explain.... i am not
The boundary conditions in
I think there's a mistake in
@admin.... plzzz help me..i m
yes it should be between 0