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:||C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.