#P1412. 经营与开发
经营与开发
Description
The concept system refers to a widely used and mature system in PC strategy games, named after four English words that all begin with EX.
- (exploration)
- (expansion and development)
- (operation and development)
- (conquest)
— Wikipedia
This time we focus on the exploit part and simplify its model:
You pilot a spaceship with a drill (initial capability value ), flying in a fixed route through planets in order. Planets are broadly divided into types: resource and maintenance. (Let be the current capability of the drill.)
- Resource type: mineral mass . If you choose to mine, you gain money, and then the drill wears by , i.e., .
- Maintenance type: maintenance fee . If you choose to repair, you pay money, and then the drill is restored by , i.e., .
Note: After maintenance, the drill’s capability value can exceed the initial value (you can think of it as refurbishment + upgrade).
Your balance may go into overdraft.
As the captain, make careful choices to maximize income.
Input Format
The first line contains integers .
The next lines each contain integers .
- If , it is a resource planet and is its mineral mass .
- If , it is a maintenance planet and is its maintenance fee .
Output Format
Output a real number (rounded to decimal places) representing the maximum income.
5 50 50 10
1 10
1 20
2 10
2 20
1 30
375.00
Hint
Constraints
- For of the testdata, .
- For another of the testdata, , .
- For of the testdata, , , and the answer is guaranteed not to exceed .
Translated by ChatGPT 5
京公网安备 11011102002149号