CF8D.Two Friends

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Two neighbours, Alan and Bob, live in the city, where there are three buildings only: a cinema, a shop and the house, where they live. The rest is a big asphalt square.

Once they went to the cinema, and the film impressed them so deeply, that when they left the cinema, they did not want to stop discussing it.

Bob wants to get home, but Alan has to go to the shop first, and only then go home. So, they agreed to cover some distance together discussing the film (their common path might pass through the shop, or they might walk circles around the cinema together), and then to part each other's company and go each his own way. After they part, they will start thinking about their daily pursuits; and even if they meet again, they won't be able to go on with the discussion. Thus, Bob's path will be a continuous curve, having the cinema and the house as its ends. Alan's path — a continuous curve, going through the shop, and having the cinema and the house as its ends.

The film ended late, that's why the whole distance covered by Alan should not differ from the shortest one by more than t1t_{1} , and the distance covered by Bob should not differ from the shortest one by more than t2t_{2} .

Find the maximum distance that Alan and Bob will cover together, discussing the film.

双人成行

Alan和Bob是两位邻居,住在同一个城市中。然而,这个城市只有三栋建筑物,分别是电影院、一个商铺和他们居住的居民楼。剩下的就是空空荡荡的柏油路了。

有一天,他们去了电影院看电影,电影触动了他们。当他们看完电影离场后,他们一直在谈论有关电影的内容,久久不能停息。

Bob想要回家,但是Alan想要先去商铺一趟,然后再回家。他们约定好一起走一段路来谈论有关电影的事宜(他们同时走的路可能会经过商店,他们也可以围绕着电影院兜圈)。然后两个人分别各自前往自己的家家。分开后,他们会开始思考自己的日常追求(白日梦);即使再次见面,他们也不会再讨论有关电影的事宜了。因此,Bob的路径将是一条连续的曲线,以电影院和房子为终点。Alan的路径——一条连续的曲线,穿过商店,以电影院和房子为终点。

电影结束得很晚,这就是为什么Alan走过的整个距离与最短距离的差距不应超过t1t1,而Bob走过的距离与最短距离的差距不应超过t2t2

你的任务是出求Alan和Bob在讨论电影时一起走过的最大距离。

感谢Macw提供翻译

输入格式

The first line contains two integers: t1,t2t_{1},t_{2} ( 0<=t1,t2<=1000<=t_{1},t_{2}<=100 ). The second line contains the cinema's coordinates, the third one — the house's, and the last line — the shop's.

All the coordinates are given in meters, are integer, and do not exceed 100 in absolute magnitude. No two given places are in the same building.

输入包含四行。
第一行输入两个整数t1,t2t1, t2
第二行输入电影院的坐标。
第三行输入房子的坐标。
第四行输入商铺的坐标。

输出格式

In the only line output one number — the maximum distance that Alan and Bob will cover together, discussing the film. Output the answer accurate to not less than 4 decimal places.

输出包含一个浮点数,表示Alan和Bob一起走过的最大路程。本题采用Special Judge,输出小数与标准解的误差在万分之一内可被接受。

输入输出样例

  • 输入#1

    0 2
    0 0
    4 0
    -3 0
    

    输出#1

    1.0000000000
    
  • 输入#2

    0 0
    0 0
    2 0
    1 0
    

    输出#2

    2.0000000000
    

说明/提示

请注意,本题空间限制为64MB,是默认空间限制的二分之一。

首页