MINERALS - Starcraft
Description
In Starcraft, the Terran race has a unit called the T-280 SCV.
Among other things, the SCV can collect minerals. For simplicity, assume that each SCV collects 1 mineral per second. Minerals are discrete (they cannot be divided), so only once after a full second is the mineral collected.
A Command Center takes 17 seconds and consumes 50 minerals to produce one SCV. It can build only one SCV at a time.
Suppose a player is alone on a map, and starts with no minerals, a single Command Center, and a given number of SCVs. If the player does nothing but collect minerals and produce SCVs as as fast as possible, how long would it take to collect all available minerals on the map?
For example, if a player started with one SCV (and one Command Center) and 71 minerals were available, it would take 69 seconds to collect all of them.
Time | SCV | Minerals | Minerals collected so far |
---|---|---|---|
0 | 1 | 0 | 0 |
... | |||
49 | 1 | 49 | 49 |
50 | 1 | 0 | 50 |
... | |||
66 | 1 | 16 | 66 |
67 | 2 | 17 | 67 |
68 | 2 | 19 | 69 |
69 | 2 | 21 | 71 |
Intially, the rate of mineral gathering is 1 per second. At 50 seconds, the Command Center starts building a second SCV, which finishes at 67 seconds. Thus, at 67 seconds, the total rate of mineral gathering becomes 2 per second.
Input
The first line is the number of starting SCVs, from 1 to 50 inclusive.
The second line is the total number of available minerals, from 1 to 10000 inclusive.
Output
The number of seconds required to collect the minerals. Round up to the nearest second.
Input | Input |
---|---|
1 71 |
1 10000 |
Output | Output |
69 |
658 |
hide comments
reggaeguitar:
2014-07-15 02:13:16
Note this sentence "It can build only one SCV at a time." |
Added by: | BYU Admin |
Date: | 2013-10-18 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |