Problem Statement | |||||||||||||
题目简述: 有n只兔子,第i只和第j只同时工作会产生P[i][j]的利益, 现在你要挑选出k只兔子,使得利益总和除以( k*(200-k) )最大。 数据范围: n<=50 0<=P[i][j]<10,且P[i][j]为整数 N rabbits (numbered 0 through N - 1) aim to work at the new TopCoder office in Rabbitland. You are to choose some of these applicants as employees. Each pair of rabbits will make a certain profit when they work together. Given a group of rabbits, we can easily compute the total profit P as the sum of profits for each pair of rabbits in the group. However, hiring rabbits also brings some costs: they want to have a supply of fresh carrots. Surprisingly, the cost of supplying carrots to K rabbits is not linear in K. This cost is given by the formula C = (K * (200 - K)). The efficiency of a given group of rabbits is the real number (P / C), where P is their total profit and C is the cost of supplying carrots for them. You are given a vector <string> profit, the j-th character of the i-th element of which represents the profit gained from rabbit i and rabbit j working together. The characters '0', '1', ..., '9' represent the values 0, 1, ..., 9, respectively. You may hire an arbitrary non-empty subset of the available rabbits. Return the maximum possible efficiency of the group of hired rabbits. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Limits | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | The returned value must have an absolute or relative error less than 1e-9. | ||||||||||||
Constraints | |||||||||||||
- | profit will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of profit will contain exactly N characters, where N is the number of elements in profit. | ||||||||||||
- | Each character in each element of profit will be a digit ('0' - '9'). | ||||||||||||
- | For each index i and j, the i-th character of the j-th element of profit will be equal to the j-th character of the i-th element of profit. | ||||||||||||
- | For each index i, the i-th character of the i-th element of profit will be '0'. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.