All submissions for this problem are available.
Sam was disappointed by the fact that he couldn't be of any help to the Night's Watch. Jon always had a soft spot for Sam so he came up with an idea on how to make Sam useful for the Night's Watch. He told Sam to get equipment from Mole's Town for the Watch's Armory. Sam accepted the task and was delighted.
Jon needed only three kinds of weapons, namely Shields,Swords and Spears. Each Crow ( member of the Night's Watch) needed a fixed amount of Shields Swords and Spears.Also some Shields ,Swords and Spears are already in the armory.
Jon gave Sam some money with which he could buy the equipment.Each type of equipment had its own cost.Sam was to use all or some of the money to buy equipment so that a maximum number of Crows can be equipped and ready.
You are to tell Jon, after Sam returns what is the maximum number of Crows that can be equipped and ready.
Each test file has a single test case. The test case starts with a single line containing 3 integers, A (0<=A<=100) , B (0<=B<=100) and C(0<=C<=100) the number of Shields, Swords and spears respectively that a single Crow needs to be equipped and ready.The next line contains 3 integers Sa(0<=Pa<=100) , Sb(0<=Pb<=100) and Sc(0<=Pc<=100) the number of Shields,Swords and Spears in the armory.The next line contains 3 integers Pa (1<=Pa<=100) , Pb(1<=Pb<=100) and Pc(1<=Pc<=100) the price of a single Shield,Sword and Spear respectively.The last line contains X (0<=X<=10^12) the money with Sam.
The output should consist of a single line with the maximum number of Crows that can be equipped and ready when Sam returns with the equipment.
Input: 3 2 1 6 4 1 1 2 3 4 Output: 2
Each Crow needs 3 Shields , 2 Swords and 1 Spear to be equipped and ready. The armory already has 6 Shields , 4 Swords and 1 Spear. This can be used to equip only 1 Crow due to lack of Spears. Then Sam can go to the village to buy 1 more Spear for cost of 3 units and then return so as to fully equip 1 more Crow, giving a total of 2 crows.
|Time Limit:||0.194757 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, CLOJ, FS|
Fetching successful submissions