编程介的小学生 2019-03-23 21:29 采纳率: 20.5%
浏览 215

圆形的切线的问题,要求比较高的精度,浮点数的算法问题,用C语言实现

Problem Description
Edward is a worker for Aluminum Cyclic Machinery.
His work is to control the mechanical arms to cut out some parts of the mould material.
Here is a brief introduction to his work.

Suppose the operation panel for him is a Euclidean plane with the coordinate system.
Originally the mould is a disc whose centre coordinates is (0,0) and of radius R.
Edward controls n different mechanical arms to cut out and erase those all of the mould within their affected areas.
The affected area of the i-th mechanical arm is a circle whose centre coordinate is (xi,yi) and of radius ri.
In order to obtain the highly developed product, it is guaranteed that the affected areas of any two mechanical arms share no intersection and no one has an affected area containing the whole original mould.

Your task is to determine the diameter of the residual mould.
Here the diameter of a subset, which may not be convex, over the Euclidean plane is the supremum (i.e. the least upper bound) of distances between every two points in the subset.
Here is an illustration of the sample.

Input
The input contains several test cases, and the first line contains a positive integer T indicating the number of test cases which is up to 5000.

For each test case, the first line contains two integers n and R, where 1≤n≤100 and 1≤R≤1000.

The following n lines describe all mechanical arms controlled by Edward, the i-th of which contains three integers xi,yi and ri describing the affected area of the i-th mechanical arm, where −1000≤xi,yi≤1000 and 1≤ri≤1000.

Output
For each test case, output a line containing "Case #x: y"(without quotes), where x is the test case number starting from 1, and y is the diameter of the remaining area with an absolute or relative error of at most 10−9.
Precisely speaking, assume that your answer is a and and the jury's answer is b, your answer will be considered correct if |a−b|max{1,|b|}≤10−9, where max{x,y} means the maximum of x and y and |x| means the absolute value of x.

Sample Input
1
3 10
0 12 10
11 -6 10
-11 -6 10

Sample Output
Case #1: 18.611654895000252

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 c程序不知道为什么得不到结果
    • ¥40 复杂的限制性的商函数处理
    • ¥15 程序不包含适用于入口点的静态Main方法
    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置