CF190B.Surrounded

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

So, the Berland is at war with its eternal enemy Flatland again, and Vasya, an accountant, was assigned to fulfil his duty to the nation.

Right now the situation in Berland is dismal — their both cities are surrounded! The armies of flatlanders stand on the borders of circles, the circles' centers are in the surrounded cities. At any moment all points of the flatland ring can begin to move quickly in the direction of the city — that's the strategy the flatlanders usually follow when they besiege cities.

The berlanders are sure that they can repel the enemy's attack if they learn the exact time the attack starts. For that they need to construct a radar that would register any movement at the distance of at most r from it. Thus, we can install a radar at such point, that at least one point of the enemy ring will be in its detecting range (that is, at a distance of at most r). Then the radar can immediately inform about the enemy's attack.

Due to the newest technologies, we can place a radar at any point without any problems. But the problem is that the berlanders have the time to make only one radar. Besides, the larger the detection radius (r) is, the more the radar costs.

That's why Vasya's task (that is, your task) is to find the minimum possible detection radius for the radar. In other words, your task is to find the minimum radius r (r ≥ 0) such, that a radar with radius r can be installed at some point and it can register the start of the movements of both flatland rings from that point.

In this problem you can consider the cities as material points, the attacking enemy rings - as circles with centers in the cities, the radar's detection range — as a disk (including the border) with the center at the point where the radar is placed.

因此,贝尔兰德再次与宿敌弗拉特兰德开战,而瓦西娅——一名会计——被委以报效祖国的重任。

目前贝尔兰德的局势十分严峻——其两座城市均已被围困!弗拉特兰德军队驻扎在两个圆形包围圈的边界上,这两个圆的圆心分别位于被围困的城市处。在任意时刻,弗拉特兰德环形阵列上的所有点都可能迅速朝对应城市方向移动——这正是弗拉特兰德军队围攻城市时惯用的战术。

贝尔兰德人确信:只要能准确获知敌军进攻发起的时刻,他们便能成功击退此次进攻。为此,他们需要建造一台雷达,使其能够探测到距离它至多为 rr 的任何运动。换言之,我们可以将雷达安装在某个位置,使得该雷达的探测范围内(即与雷达安装点距离不超过 rr)至少包含敌方环形阵列上的一个点;如此一来,雷达即可立即发出敌军进攻的警报。

得益于最新技术,我们可毫无困难地将雷达安置于任意位置。但问题在于:贝尔兰德人仅来得及制造一台雷达。此外,雷达的探测半径 rr 越大,其造价也越高。

因此,瓦西娅的任务(即你的任务)便是找出雷达所需的最小可能探测半径。换句话说,你需要找出最小的半径 rr(其中 r≥0r \geq 0),使得存在某一点可安装一台探测半径为 rr 的雷达,且该雷达能同时探测到两个弗拉特兰德环形阵列开始运动的信号。

在本题中,你可以将城市视为质点,将发动进攻的敌方环形阵列视为以城市为圆心的圆,将雷达的探测范围视为以雷达安装点为圆心、半径为 rr 的闭圆盘(含边界)。

输入格式

The input files consist of two lines. Each line represents the city and the flatland ring that surrounds it as three space-separated integers x__i, y__i, r__i (|x__i|, |y__i| ≤ 104; 1 ≤ r__i ≤ 104) — the city's coordinates and the distance from the city to the flatlanders, correspondingly.

It is guaranteed that the cities are located at different points.

输入文件包含两行。每行表示一座城市及其周围的平坦地带环,由三个以空格分隔的整数 xix_i、yiy_i、rir_i(∣xi∣, ∣yi∣ ≤ 104|x_i|, |y_i| \leq 10^4;1 ≤ ri ≤ 1041 \leq r_i \leq 10^4)给出——分别表示城市的坐标以及城市到平坦居民的距离。

保证两座城市位于不同的点上。

输出格式

Print a single real number — the minimum detection radius of the described radar. The answer is considered correct if the absolute or relative error does not exceed 10 - 6.

输出一个实数——所述雷达的最小探测半径。若答案的绝对或相对误差不超过 10−610^{-6},则视为正确。

输入输出样例

  • 输入#1

    0 0 1
    6 0 3

    输出#1

    1.000000000000000
  • 输入#2

    -10 10 3
    10 -10 3

    输出#2

    11.142135623730951

说明/提示

The figure below shows the answer to the first sample. In this sample the best decision is to put the radar at point with coordinates (2, 0).

The figure below shows the answer for the second sample. In this sample the best decision is to put the radar at point with coordinates (0, 0).

下图展示了第一个样例的答案。在该样例中,最优决策是将雷达放置在坐标为 (2, 0)(2,\,0) 的点处。

下图展示了第二个样例的答案。在该样例中,最优决策是将雷达放置在坐标为 (0, 0)(0,\,0) 的点处。

输入解题思路,AI测评打分。不知道怎么写?

首页