来源:http://noi.openjudge.cn/ch0406/20/
Communication System
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.
输入
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.
输出
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.
样例输入
1 3 3 100 25 150 35 80 25 2 120 80 155 40 2 100 100 120 110
样例输出
0.649
翻译:
我们已收到Pizoor Communications Inc.的特殊通信系统的订单。该系统由多个设备组成。对于每个设备,我们可以从多个制造商处自由选择。来自两个制造商的相同设备在最大带宽和价格方面有所不同。?
?通过总带宽(B),我们指的是通信系统中所选设备的最小带宽,总价格(P)是所有所选设备的价格之和。我们的目标是为每个设备选择一个制造商,以最大限度地提高B / P。?
输入
?输入文件的第一行包含单个整数 t(1 ≤ t ≤ 10),即测试用例的数量,后跟每个测试用例的输入数据。每个测试用例都以包含单个整数n(1 ≤n≤100)的行开始,这是通信系统中的设备数量,然后是以下格式的n行:第i行(1≤i≤n)以mi(1≤mi≤100)开头,第i个设备的制造商数量, 后跟同一行中的正整数对 mi,每对分别指示设备的带宽和价格,对应于制造商。?
输出
?您的程序应为每个测试用例生成一行,其中包含一个数字,这是测试用例的最大可能 B/P。将输出中的数字舍入为小数点后 3 位数字。?