21953_TrackSmoothing

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

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

Pro.ID

21953

Title

Track Smoothing

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 6000/3000 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    Bob has the task to plan a racing track of a specific length. He thought it is a great idea to just form a convex polygon that has exactly the required length. Then he was told that racing cars cannot drive such sharp corners like in his plan.

    He has to ensure some minimal radius for all curves in his track. Bobs loves the shape of his track, so he don't want to change it too much. His plan is to scale the track down around the balance point of the polygon that specifies his track. Then, he wants to draw the new track with a line that has a constant distance to the scaled track. The chosen distance should be minimal distance that fulfills the given minimum radius constraint. He asks you to write a program to calculate the scale factor for a given track and minimum radius so that the resulting track has the same length as the one of his original plan. Bob made some drawings of the first test case:

    输入

    The input starts with the number of test cases t (0 < t ≤ 100). Every test case starts with a line consisting of two integers: the minimal required radius r and the number of points n of the original track polygon (0 ≤ r ≤ 1000 , 3 ≤ n ≤ 10000). Then n lines follow, where each line specifies 2D-coordinates as two integers xi and yi (-10000 ≤ xi, yi ≤ 10000). (0, 0) is the lower left corner. These are the coordinates of the original track in counterclockwise direction. You may safely assume that the area of the given polygon is non-empty.

    输出

    Description

    Bob has the task to plan a racing track of a specific length. He thought it is a great idea to just form a convex polygon that has exactly the required length. Then he was told that racing cars cannot drive such sharp corners like in his plan.

    He has to ensure some minimal radius for all curves in his track. Bobs loves the shape of his track, so he don't want to change it too much. His plan is to scale the track down around the balance point of the polygon that specifies his track. Then, he wants to draw the new track with a line that has a constant distance to the scaled track. The chosen distance should be minimal distance that fulfills the given minimum radius constraint. He asks you to write a program to calculate the scale factor for a given track and minimum radius so that the resulting track has the same length as the one of his original plan. Bob made some drawings of the first test case:

    Input

    The input starts with the number of test cases t (0 < t ≤ 100). Every test case starts with a line consisting of two integers: the minimal required radius r and the number of points n of the original track polygon (0 ≤ r ≤ 1000 , 3 ≤ n ≤ 10000). Then n lines follow, where each line specifies 2D-coordinates as two integers xi and yi (-10000 ≤ xi, yi ≤ 10000). (0, 0) is the lower left corner. These are the coordinates of the original track in counterclockwise direction. You may safely assume that the area of the given polygon is non-empty.

    Output

    For each test case print out one line. If it is possible to construct a course according to the above description, output the scaling factor, "Not possible" otherwise. The factor must have a relative or absolute error smaller than 10-5.

    Sample Input

    2
    20 5
    10 0
    110 0
    130 20
    0 150
    0 10
    1 5
    0 0
    1 0
    2 0
    2 1
    0 1

    Sample Output

    0.730494
    Not possible

    Source

    样例输入

    2
    20 5
    10 0
    110 0
    130 20
    0 150
    0 10
    1 5
    0 0
    1 0
    2 0
    2 1
    0 1

    样例输出

    0.730494
    Not possible

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部