| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 863 人关注过本帖
标题:[讨论]ZJU1409:Communication System
只看楼主 加入收藏
leeco
Rank: 4
等 级:贵宾
威 望:10
帖 子:1029
专家分:177
注 册:2007-5-10
结帖率:50%
收藏
 问题点数:0 回复次数:2 
[讨论]ZJU1409:Communication System

应该是道DP题,大家有什么想法讨论一下
http://acm.zju.edu.cn/show_problem.php?pid=1409

Communication System

--------------------------------------------------------------------------------

Time limit: 10 Seconds Memory limit: 32768K
Total Submit: 500 Accepted Submit: 194

--------------------------------------------------------------------------------

We have received an order from Pizoor Communications Inc. for a special communication system. The system consists of several devices. For each device, we are free to choose from several manufacturers. Same devices from two manufacturers differ in their maximum bandwidths and prices.

By overall bandwidth (B) we mean the minimum of the bandwidths of the chosen devices in the communication system and the total price (P) is the sum of the prices of all chosen devices. Our goal is to choose a manufacturer for each device to maximize B/P.


Input

The first line of the input file contains a single integer t (1 <= t <= 10), the number of test cases, followed by the input data for each test case. Each test case starts with a line containing a single integer n (1 <= n <= 100), the number of devices in the communication system, followed by n lines in the following format: the i-th line (1 <= i <= n) starts with mi (1 <= mi <= 100), the number of manufacturers for the i-th device, followed by mi pairs of positive integers in the same line, each indicating the bandwidth and the price of the device respectively, corresponding to a manufacturer.


Output

Your program should produce a single line for each test case containing a single number which is the maximum possible B/P for the test case. Round the numbers in the output to 3 digits after decimal point.


Sample Input

1
3
3 100 25 150 35 80 25
2 120 80 155 40
2 100 100 120 110


Sample Output

0.649

搜索更多相关主题的帖子: System acm limit Submit 
2007-07-09 16:46
野比
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:1627
专家分:516
注 册:2007-5-24
收藏
得分:0 
最猛的哥们居然run time只有0.01sec...PF

女侠,约吗?
2007-07-09 21:35
冰蓝色锋
Rank: 1
等 级:新手上路
帖 子:167
专家分:0
注 册:2006-10-30
收藏
得分:0 
英语不好    看不明白

2007-07-10 08:42
快速回复:[讨论]ZJU1409:Communication System
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016311 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved