hdoj1009FatMouse' Trade(贪心求解)
来源:互联网 发布:mysql 修改复合主键 编辑:程序博客网 时间:2024/05/01 10:57
Problem Description
FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.
The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requires F[i] pounds of cat food. FatMouse does not have to trade for all the JavaBeans in the room, instead, he may get J[i]* a% pounds of JavaBeans if he pays F[i]* a% pounds of cat food. Here a is a real number. Now he is assigning this homework to you: tell him the maximum amount of JavaBeans he can obtain.
The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requires F[i] pounds of cat food. FatMouse does not have to trade for all the JavaBeans in the room, instead, he may get J[i]* a% pounds of JavaBeans if he pays F[i]* a% pounds of cat food. Here a is a real number. Now he is assigning this homework to you: tell him the maximum amount of JavaBeans he can obtain.
Input
The input consists of multiple test cases. Each test case begins with a line containing two non-negative integers M and N. Then N lines follow, each contains two non-negative integers J[i] and F[i] respectively. The last test case is followed by two -1's. All integers are not greater than 1000.
Output
For each test case, print in a single line a real number accurate up to 3 decimal places, which is the maximum amount of JavaBeans that FatMouse can obtain.
Sample Input
5 37 24 35 220 325 1824 1515 10-1 -1
Sample Output
13.33331.500
- hdoj1009FatMouse' Trade(贪心求解)
- hdoj1009FatMouse' Trade(贪心)
- hdoj1009FatMouse' Trade(贪心)
- 【贪心】 hdu1009 FatMouse' Trade
- ZOJ FatMouse' Trade 贪心
- 贪心之FatMouse' Trade
- hdu1009 FatMouse' Trade(贪心)
- FatMouse' Trade hdu+贪心
- HDU1009 FatMouse' Trade贪心
- HDU1009 FatMouse' Trade 【贪心】
- HDU1009 FatMouse' Trade 贪心
- FatMouse' Trade--贪心
- HDU1009_FatMouse' Trade【贪心】【水题】
- FatMouse' Trade 贪心
- 贪心初步-FatMouse' Trade
- 【贪心】FatMouse' Trade
- 贪心 FatMouse' Trade
- hdu1009 FatMouse' Trade(贪心)
- Android 使用Handler实现Thread间通信
- 深入了解Linux设备模型
- hdoj1015Safecracker(深度优先搜索)
- 百万级PHP网站架构工具箱
- 多少傻逼为红颜, 多少红颜不要脸
- hdoj1009FatMouse' Trade(贪心求解)
- linux驱动理论专拦
- 在浏览器右键添加自定义菜单
- AndroidGUI07:SeekBar的常用技巧
- 传统模拟摄像机发展之路:向左走,向右走?
- 精摘语录
- GDB使用命令
- QT学习 第一章:基本对话框--各种信息框的使用
- android HTTP 通信, XML 解析, 通过 Hander 实现异步消息处理 (1)