#P1412. 经营与开发

    ID: 405 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>动态规划,dp福建省历届夏令营

经营与开发

Description

The 4X4X concept system refers to a widely used and mature system in PC strategy games, named after four English words that all begin with EX.

  • eXplore\verb!eXplore! (exploration)
  • eXpand\verb!eXpand! (expansion and development)
  • eXploit\verb!eXploit! (operation and development)
  • eXterminate\verb!eXterminate! (conquest)

— Wikipedia

This time we focus on the exploit part and simplify its model:

You pilot a spaceship with a drill (initial capability value ww), flying in a fixed route through nn planets in order. Planets are broadly divided into 22 types: resource and maintenance. (Let pp be the current capability of the drill.)

  1. Resource type: mineral mass aia_i. If you choose to mine, you gain ai×pa_i \times p money, and then the drill wears by k%k\%, i.e., pp×(10.01k)p \gets p \times (1 - 0.01k).
  2. Maintenance type: maintenance fee bib_i. If you choose to repair, you pay bi×pb_i \times p money, and then the drill is restored by c%c\%, i.e., pp×(1+0.01c)p \gets p \times (1 + 0.01c).

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 44 integers n,k,c,wn, k, c, w.

The next nn lines each contain 22 integers type,x\mathrm{type}, x.

  • If type=1\mathrm{type} = 1, it is a resource planet and xx is its mineral mass aia_i.
  • If type=2\mathrm{type} = 2, it is a maintenance planet and xx is its maintenance fee bib_i.

Output Format

Output a real number (rounded to 22 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 30%30\% of the testdata, n100n \le 100.
  • For another 20%20\% of the testdata, n1000n \le 1000, k=100k = 100.
  • For 100%100\% of the testdata, n100000n \le 100000, 0k,c,w,ai,bi1000 \le k, c, w, a_i, b_i \le 100, and the answer is guaranteed not to exceed 10910^9.

Translated by ChatGPT 5