Pro.ID22138 TitleDivision of Board Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22138 AC2 Submit12 Ratio16.67% 时间&空间限制描述Zephyr is a good carpenter. One day he got a large rectangular board, which he wanted to divide it into N equal-area rectangular pieces (Note that each cut is parallel to edge of the board, and will cut one existing piece into two pieces). As Zephyr is a flakey man, he preferred the N smaller pieces look like square. To each piece of wooden board, he defined a ratio P=L/S (L is the length of its longer side, S is the length of its shorter side). Zephyr wanted to minimize the sum of P of N pieces. Can you help him to figure out the minimum result? 输入The first line contains an integer K, which is the number of test cases. For each test case, there will a line contains three integers x, y, N ( 1 ≤ x, y ≤ 3000, 1 ≤ N ≤ 15 ). x and y are the length and width of the board. N is the number Zephyr wanted to divide the board into. 输出Description Zephyr is a good carpenter. One day he got a large rectangular board, which he wanted to divide it into N equal-area rectangular pieces (Note that each cut is parallel to edge of the board, and will cut one existing piece into two pieces). As Zephyr is a flakey man, he preferred the N smaller pieces look like square. To each piece of wooden board, he defined a ratio P=L/S (L is the length of its longer side, S is the length of its shorter side). Zephyr wanted to minimize the sum of P of N pieces. Can you help him to figure out the minimum result? Input The first line contains an integer K, which is the number of test cases. For each test case, there will a line contains three integers x, y, N ( 1 ≤ x, y ≤ 3000, 1 ≤ N ≤ 15 ). x and y are the length and width of the board. N is the number Zephyr wanted to divide the board into. Output For each test case, output a line contains the minimum sum of P of N pieces. Round the numbers in the output to 6 digits after decimal point. Sample Input 2 Sample Output 12.000000 Source 样例输入2 样例输出12.000000 作者 |