FatMouse' Trade(水题,结构体排序,适合c初学者)
2018-03-26 18:34
260 查看
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.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 3 7 2 4 3 5 2 20 3 25 18 24 15 15 10 -1 -1
Sample Output
13.33331.500
相关文章推荐
- HDU 1009 FatMouse' Trade (贪心、结构体排序)
- HDU 1009 FatMouse' Trade 贪心水题
- HDU1234_开门人和关门人【结构体排序】【水题】
- HDU1009_FatMouse' Trade【贪心】【水题】
- SDNU 1281.谁是第一名 水题 结构体排序 注意名字比较
- 快速排序与合并排序时间比较(适合初学者)
- ACMSTEP 1.3.4 百步穿杨 //水题 结构体排序
- 结构体和类的区别(适合初学者C和C++学习)
- ACMSTEP 1.3.1 FatMouse Trade //结构体排序
- HDU 2093 水题,就是注意一下细节,有个结构体的排序,重载运算符小于
- qsort结构体排序 (初学者必知)
- 平面点排序(一)(结构体专题)
- 【杭电oj】1225 - Football Score(结构体排序)
- 最适合初学者的 IntelliJ IDEA 教程 - HelloWorld 和相关设置
- STL 之sort函数结构体排序
- UNIX/Linux shell脚本 if语句的几个案例(适合Linux初学者)
- 精 挑 细 选(结构体排序)
- 推荐几本适合初学者的Java书籍
- HDU 1009 FatMouse' Trade
- STL_qsort(对int,char,vector,结构体排序举例)