2507: 【普及/提高-】【P3743】kotori的设备

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:0 解决:0

题目描述

kotori 有 lns="http://www.w3.org/1998/Math/MathML"> 个可同时使用的设备。

题目描述

第 lns="http://www.w3.org/1998/Math/MathML"> 个设备每秒消耗 lns="http://www.w3.org/1998/Math/MathML"> 个单位能量。能量的使用是连续的,也就是说能量不是某时刻突然消耗的,而是匀速消耗。也就是说,对于任意实数,在 lns="http://www.w3.org/1998/Math/MathML"> 秒内消耗的能量均为 lns="http://www.w3.org/1998/Math/MathML">× 单位。在开始的时候第 lns="http://www.w3.org/1998/Math/MathML"> 个设备里存储着 lns="http://www.w3.org/1998/Math/MathML"> 个单位能量。

同时 kotori 又有一个可以给任意一个设备充电的充电宝,每秒可以给接通的设备充能 lns="http://www.w3.org/1998/Math/MathML"> 个单位,充能也是连续的,不再赘述。你可以在任意时间给任意一个设备充能,从一个设备切换到另一个设备的时间忽略不计。

kotori 想把这些设备一起使用,直到其中有设备能量降为 lns="http://www.w3.org/1998/Math/MathML">0。所以 kotori 想知道,在充电器的作用下,她最多能将这些设备一起使用多久。

输入

第一行给出两个整数 lns="http://www.w3.org/1998/Math/MathML">,

接下来 lns="http://www.w3.org/1998/Math/MathML"> 行,每行表示一个设备,给出两个整数,分别是这个设备的 lns="http://www.w3.org/1998/Math/MathML"> 和 lns="http://www.w3.org/1998/Math/MathML">

输出

如果 kotori 可以无限使用这些设备,输出 lns="http://www.w3.org/1998/Math/MathML">1

否则输出 kotori 在其中一个设备能量降为 lns="http://www.w3.org/1998/Math/MathML">0 之前最多能使用多久。

设你的答案为 lns="http://www.w3.org/1998/Math/MathML">,标准答案为 lns="http://www.w3.org/1998/Math/MathML">,只有当 lns="http://www.w3.org/1998/Math/MathML">, 满足 lns="http://www.w3.org/1998/Math/MathML">riptlevel="0">max(1,)104 的时候,你能得到本测试点的满分。

样例输入 复制

2 1
2 2
2 1000

样例输出 复制

2.0000000000

提示

对于 lns="http://www.w3.org/1998/Math/MathML">100% 的数据,lns="http://www.w3.org/1998/Math/MathML">1100000lns="http://www.w3.org/1998/Math/MathML">1100000lns="http://www.w3.org/1998/Math/MathML">1,100000