CF605C.Freelancer's Dreams
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Mikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool programmer, he needs at least p experience points, and a desired flat in Moscow costs q dollars. Mikhail is determined to follow his dreams and registered at a freelance site.
He has suggestions to work on n distinct projects. Mikhail has already evaluated that the participation in the i-th project will increase his experience by a__i per day and bring b__i dollars per day. As freelance work implies flexible working hours, Mikhail is free to stop working on one project at any time and start working on another project. Doing so, he receives the respective share of experience and money. Mikhail is only trying to become a cool programmer, so he is able to work only on one project at any moment of time.
Find the real value, equal to the minimum number of days Mikhail needs to make his dream come true.
For example, suppose Mikhail is suggested to work on three projects and _a_1 = 6, _b_1 = 2, _a_2 = 1, _b_2 = 3, _a_3 = 2, _b_3 = 6. Also, p = 20 and q = 20. In order to achieve his aims Mikhail has to work for 2.5 days on both first and third projects. Indeed, _a_1·2.5 + _a_2·0 + _a_3·2.5 = 6·2.5 + 1·0 + 2·2.5 = 20 and _b_1·2.5 + _b_2·0 + _b_3·2.5 = 2·2.5 + 3·0 + 6·2.5 = 20.
自由职业者米哈伊尔有两个梦想:成为一名优秀的程序员,以及在莫斯科买一套公寓。要成为一名优秀的程序员,他至少需要 p 点经验;而他心仪的莫斯科公寓售价为 q 美元。米哈伊尔决心追逐梦想,因此注册了一个自由职业网站。
他收到了 n 个不同项目的邀约。米哈伊尔已评估出:参与第 i 个项目每天可为他增加 ai 点经验,并带来 bi 美元收入。由于自由职业工作时间灵活,米哈伊尔可在任意时刻停止一个项目并立即开始另一个项目;切换时,他将按实际工作天数获得对应的经验与收入。米哈伊尔的目标仅为成为优秀程序员,因此他任意时刻最多只能从事一个项目。
请找出一个实数值,即米哈伊尔实现梦想所需的最少天数。
例如,假设米哈伊尔被邀请参与三个项目,且 a1=6、b1=2,a2=1、b2=3,a3=2、b3=6;同时 p=20,q=20。为达成目标,米哈伊尔需在第一个和第三个项目上各工作 2.5 天。事实上,a1⋅2.5+a2⋅0+a3⋅2.5=6⋅2.5+1⋅0+2⋅2.5=20,且 b1⋅2.5+b2⋅0+b3⋅2.5=2⋅2.5+3⋅0+6⋅2.5=20。
输入格式
The first line of the input contains three integers n, p and q (1 ≤ n ≤ 100 000, 1 ≤ p, q ≤ 1 000 000) — the number of projects and the required number of experience and money.
Each of the next n lines contains two integers a__i and b__i (1 ≤ a__i, b__i ≤ 1 000 000) — the daily increase in experience and daily income for working on the i-th project.
输入的第一行包含三个整数 n、p 和 q(1 ≤ n ≤ 100000,1 ≤ p,q ≤ 1000000)—— 分别表示项目的数量、所需的经验值和金钱数。
接下来的 n 行中,每行包含两个整数 ai 和 bi(1 ≤ ai,bi ≤ 1000000)—— 分别表示从事第 i 个项目时每天获得的经验值增量和每日收入。
输出格式
Print a real value — the minimum number of days Mikhail needs to get the required amount of experience and money. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.
Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if
.
输出一个实数值——米哈伊尔获得所需经验值和金钱所需的最少天数。若你的答案的绝对或相对误差不超过 10−6,则视为正确。
具体而言:假设你的答案为 a,评测组的答案为 b。当满足
时,评测程序将判定你的答案正确。
输入输出样例
输入#1
3 20 20 6 2 1 3 2 6
输出#1
5.000000000000000
输入#2
4 1 1 2 3 3 2 2 3 3 2
输出#2
0.400000000000000
说明/提示
First sample corresponds to the example in the problem statement.
第一个样例对应题目描述中的示例。
输入解题思路,AI测评打分。不知道怎么写?