编程介的小学生 2019-08-24 21:50 采纳率: 20.5%
浏览 152

This Is The Job The Bear Finds是怎么代码编写的

Problem Description
This is the job the bear finds
This is the job the bear finds
This is the job the bear finds
Not with a code but a brick.

                                              - Kenneth Snow, The Hollow Bear

Bearchild is working in a construction team. Life is hard, and his job is just carrying bricks from here to there, what a waste of time! So, our lovely Bearchild has invented a strange machine to help him.
The machine consists three parts: A rope, a little, round pulley (regarded as points) and a big pulley which is a convex hull (Bearchild is short of money and can't make his big pulley round!).
One end of the rope is fixed with bricks, the rope goes around the small pulley, and finally connects the big pulley on its contour. It's guaranteed that the small pulley is located to the left of the big one.
You can see that when the big pulley spins clockwise around its center of gravity, the bricks will be pulled up, and finally reach the small pulley as the destination. Note that the rope will circle around the contour of the big pulley as it spins.
See the picture for more information, there will be no collision when spinning.

In this problem, first of all we let the pulley spin for one or more circles so the rope becomes tight.
After that, the positions of the two pulleys are given. Then you have to deal a lot of queries, for each query, the distance from the bricks and the small pulley (also as the destination) is given.
Your task is to calculate the degree the pulley has yet to spin to pull the bricks to the destination.

Input
The first line has a number T (T <= 1000) , indicating the number of test cases.
For each test case, first line is a number n, which is the number of points of the big pulley (As a convex hull). Then n lines follow, each with two numbers as the x and y coordinate of each point.
Those points are given in counter-clockwise order. Then a line with two numbers, which are the x and y coordinate of the small pulley. Those coordinates are in the range [-1000000, 1000000].
Then a number m indicating the number of queries.
For next q lines, each contains a number l (0 < l < 109), which is the distance between the bricks and the small pulley.
For 90% of the data, we have n,m <= 100, All the data have n <= 104, m <= 105, and all the numbers in the input are integers.

Output
For every case, you should output "Case #t:" at first, without quotes. The t is the case number starting from 1.
Then q lines each answers a query in the Input, which should be printed accurately rounded to three decimals.

Sample Input
2
4
0 0
1 0
1 1
0 1
-1 2
2
1
4
3
0 0
1 1
-1 1
-2 1
3
1
2
3

Sample Output
Case #1:
90.000
360.000
Case #2:
64.413
140.446
233.660

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!
    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
    • ¥15 求daily translation(DT)偏差订正方法的代码
    • ¥15 js调用html页面需要隐藏某个按钮
    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误