All submissions for this problem are available.
A chocolate manufacturing company wants to buy boxes to pack chocolates. Boxes are
available in two types, first one costs c1 and can hold n1 chocolates and the second one costs
c2 and can hold n2 chocolates. Each box to be filled to its capacity. You have to find the best
way to distribute the chocolates such that total cost is minimized.
The first line specifies the number of test cases.
For each test case, the first line of input specifies the total number of chocolate to be packed.
(numbered 1 to 300,000,000). The next line contains c1 n1 c2 n2. A test case containing zero
for the number of chocolates indicates termination of input.
For each test case in the input print a line containing the minimum cost solution (two
nonnegative integers m1 and m2, where mi = number of type i boxes required if one
exists. Otherwise print 0 0.
Input: 44 10 9 9 8 37 10 9 9 8 0 Output: 41 00
|Time Limit:||10 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, 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, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.