22138_DivisionofBoard

2022-5-16 18:21| 发布者: Hocassian| 查看: 21| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506141746200-Problem List-采集的数据-后羿采集器.html

Pro.ID

22138

Title

Division of Board

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22138

AC

2

Submit

12

Ratio

16.67%

时间&空间限制

  • Time Limit: 10000/5000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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
    15 20 8
    34 53 14

    Sample Output

    12.000000
    16.515776

    Source

    样例输入

    2
    15 20 8
    34 53 14

    样例输出

    12.000000
    16.515776

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部