The Production ManagerProblem code: RBX12R03 |
All submissions for this problem are available.
Production Manager of a biscuit manufacturing company- “Ban-2g Pvt. Ltd.” needs a solution. The biscuits are manufactured just on time and are ready to be delivered to a Japanese store. But just a day before the delivery, the company who had taken the contract of packaging the biscuits, changes the cost of all its delivery boxes.
Ban-2g Pvt. Ltd. wants to buy boxes which are available in two types, first one costs c1 and can hold n1 biscuits and the second one costs c2 and can hold n2 biscuits. Each box has to be filled to its capacity. You have to find the best way to distribute the biscuits such that total cost is minimized.
Input
The first line specifies the number of test cases. For each test case, the first line of input specifies the total number of biscuits to be packed. (numbered 1 to 300,000,000). The next line contains c1, n1, c2, n2.
Output
For each test case in the input, print a line containing the minimum cost solution i.e. three non-negative integers m1, m2 and minimum cost (mi = number of type ‘i’ boxes required if one exists). Otherwise print 0 0 0.
Example
Input: 2 78 10 15 1 8 37 10 9 9 8 Output: 2 6 26 0 0 0 Explanation In the 1st test case, no of biscuits to be packed is 78. The output is “2 6 26” (“2” boxes of size 15, “6” boxes of size 8 and hence the cost is “26”)
| Author: | rishi_agarwal |
| Date Added: | 15-02-2012 |
| Time Limit: | 50 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, FORT, FS, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
|
If you are still having problems, see a sample solution here. |

Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach.
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.
Can you provide some more