All submissions for this problem are available.
2 Milkmen Aditya and Rahul were doing very good business in their village as partners and had many milk containers of the following sizes.
The codes for each of the sizes are given in the braces they are supposed to be entered in the input as specified in INPUT section.
Can (CN) 10 gallons Pail (PL) 2 gallons Gallon (G) Quart (Q) 1/4 gallon Pint (PN) 1/8 gallon Cup (CP) 1/16 gallon
Now Rohan who lives in the same village took up a assignment to know in how many ways can the milkmen store X gallons of milk using any combination of these containers. For instance, the milkmen can store one Quart four ways:
1: 1 quart 2: 2 pints 3: 1 pint + 2 cups 4: 4 cups
One gallon can be stored 26 different ways.
In all data, X is a positive integer number and 1 <= X gallons <= 50. Rohans program must compute the number of combinations for each separate input value in less than ten seconds (which means that your program might run as long as 10*n seconds for n input values).
Your program should read values from the file first the Quantity and then followed by the code for each of the sizes as specified above in the second line (and compute and print the number of combinations) until encountering a value of #.
Your output should give the number of ways specified for the input.
A example is given below:
Sample Input 1 G # Sample Output 26
|Time Limit:||15 sec|
|Source Limit:||50000 Bytes|
|Languages:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.9.2, CPP14, CS2, D, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.4, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.