SC1 - Starcraft I

no tags 


You may play the game Starcraft I first before you do this problem ^_^.


Suppose you are using Protoss. At the beginning of the game, you have n probes, a nexus and almost unlimited number of pylons. You can build a probe in the nexus per 3 Starcraft time units(STs), and this will cost you z units of minerals. A probe can gather x units of minerals or y units of gas per ST. What's the minimum time to get A units of minerals and B units of gas, if you build probes at nexus only and don't build any buildings?

Assume that in the current map there are almost unlimited mineral fields and unlimited vespene geysers, and on each vespene geyser, a Protoss Assimilator has been built successfully.


Multiple test cases, the number of them is given in the very first line.

Each test case contains one line with 6 positive integers n, x, y, z, A, B separated by one space. All numbers in the input file will be less than 21.


For each test case, output one line, which contains a single integer, the minimum time in ST.


1 2 3 4 5 6


hide comments
kostya: 2010-07-11 08:37:26


Josef Ziegler: 2010-07-10 19:38:21

For those who haven't played starcraft for a while: with " a probe in the nexus per 3 Starcraft time units(STs)" is meant "one at a time".

Added by:Fudan University Problem Setters
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: C99 ERL JS-RHINO OBJC SQLITE