QOJ.ac

QOJ

実行時間制限: 5 s メモリ制限: 256 MB 満点: 100

#6571. 商业

統計

企业家 Bajtazar 拥有一家新成立的生产企业 Bajtex。他计划引导 Bajtex 的发展,使其在最短的时间内变得“非常盈利”,从而使他本人获得“商业大亨”的称号。如果一家公司的年收入至少达到 $D$ 百万 bajtalar,我们就称该公司是“非常盈利”的。

目前,Bajtazar 只有生产车间和 $p$ 百万 bajtalar 的初始资本。这些钱可以用来购买生产机器。此外,一旦 Bajtex 开始盈利,赚取的资金也可以用来购买更多的机器。

市场上共有 $n$ 种类型的机器。第 $i$ 种机器的价格为 $c_i$ 百万 bajtalar,每年可提供 $d_i$ 百万 bajtalar 的额外收入。购买多台同类型的机器没有任何限制。

请帮助 Bajtazar 确定他成为商业大亨所需的最短时间。我们假设购买机器(包括交付和安装)所需的时间可以忽略不计,并且会立即增加公司的收入。此外,我们假设公司是持续盈利的,即对于任何能保证年收入为 $x$ 百万 bajtalar 的机器组合,以及任何实数 $t \ge 0$,这些机器在 $t$ 年内将正好赚取 $t \cdot x$ 百万 bajtalar。

输入格式

第一行包含三个整数 $n, D, p$ ($1 \le n \le 100, 1 \le D \le 100\,000, 1 \le p \le 10^9$),分别表示机器的类型数量、要求的年收入水平(百万 bajtalar)以及 Bajtazar 的初始资本(百万 bajtalar)。

接下来的 $n$ 行描述了可用的机器类型。第 $i$ 行包含两个整数 $c_i$ 和 $d_i$ ($1 \le c_i \le 10^9, 1 \le d_i \le D$),分别表示第 $i$ 种机器的价格及其带来的年收入。

可以假设 Bajtazar 的初始资本至少可以购买一台机器。

输出格式

输出一个实数,表示 Bajtex 变得非常盈利、Bajtazar 获得商业大亨称号所需的最短时间(以年为单位)。如果结果的相对误差或绝对误差不超过 $10^{-6}$,则结果被视为正确。

样例

输入 1

3 14 6
2 2
5 6
6 7

输出 1

0.783333333

输入 2

1 1 1
1 1

输出 2

0.000000000

说明

在第一个样例中,最优策略是在公司运营之初购买一台第二种类型的机器。随后,Bajtazar 在每次有足够资金时就购买一台第一种类型的机器,直到成为商业大亨(即总共需要四台该机器)。购买后续第一种机器的时间点分别为上一次购买后的 $\frac{2}{6}, \frac{2}{8}, \frac{2}{10}$ 和 $\frac{2}{12}$ 年。

在第二个样例中,Bajtazar 在公司运营之初就有足够的资本直接成为商业大亨。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.