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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, 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, PYTH, PYTH 3.5, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.