Battle Royale games are the current trend in video games and Gamers Concealed Punching Circles (GCPC) is the most popular game of them all. The game takes place in an area that, for the sake of simplicity, can be thought of as a two-dimensional plane. Movement and positioning are a substantial part of the gameplay, but getting to a desired location can be dangerous. You are confident in your ability to handle the other players, however, while you are walking to your destination, there are two hazards posed by the game itself:

  • The game zone is bounded by a blue circle. Outside of this circle, there is a deadly force field that would instantly take you out of the game.
  • Inside the game zone, there is a red circle where you are exposed to artillery strikes. This circle is also too risky to enter.

You want to move from one spot on the map to another, but the direct path to your destination is blocked by the red circle, so you need to find a way around it. Can you find the shortest path that avoids all hazards by never leaving the blue or entering the red circle? Touching the boundaries of the circles is fine, as long as you do not cross them.

Input Format

The input consists of:

  • one line with two integers x_cxc​, y_cyc​ specifying your current location;
  • one line with two integers x_dxd​, y_dyd​ specifying your destination;
  • one line with three integers x_b, y_b, r_bxb​,yb​,rb​ specifying the center and radius of the blue circle;
  • one line with three integers x_rxr​ , y_ryr​ , r_rrr​ specifying the center and radius of the red circle.

All coordinates have an absolute value of at most 1 0001000, and 1 \le r_b, r_r \le 1 0001≤rb​,rr​≤1000. The red circle is strictly inside the blue circle. Your current location and destination are strictly inside the blue circle and strictly outside of the red circle, and the direct path between them is blocked by the red circle.

Output Format

Output the length of the shortest path that does not leave the blue or enter the red circle. The output must be accurate up to a relative or absolute error (whichever is lower) of 10^{-7}10−7.

本题答案不唯一,符合要求的答案均正确

样例输入

0 0
10 0
0 0 1000
5 0 2

样例输出

10.8112187742

题目来源

German Collegiate Programming Contest 2018​

红色部分为所求的

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
typedef long long ll;
#define lowbit(x) (x&(-x))
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
using namespace std;
#define pi acos(-1)
double sx,sy,ex,ey;
double rx,ry,rr;
double mx,my,mr;
double dist(double x1,double x2,double y1,double y2)
{
return sqrt(pow(x1-x2,)+pow(y1-y2,));
}//两点间的距离
int main()
{
scanf("%lf%lf%lf%lf",&sx,&sy,&ex,&ey);
scanf("%lf%lf%lf",&mx,&my,&mr);
scanf("%lf%lf%lf",&rx,&ry,&rr);
double a=dist(sx,rx,sy,ry);
double b=sqrt(pow(a,)-pow(rr,));//切线
double c=dist(ex,rx,ey,ry);
double d=sqrt(pow(c,)-pow(rr,));//切线
double e=dist(sx,ex,sy,ey);
//A1,A2,A3是相应的圆心角
double A1=acos(rr/a);
double A2=acos(rr/c);
double A3=acos((a*a+c*c-e*e)/(*a*c));
double A4=A3-A1-A2;
double f=A4*rr;//弧长
printf("%.10f\n",f+b+d);
return ;
}

German Collegiate Programming Contest 2018​ B. Battle Royale的更多相关文章

  1. German Collegiate Programming Contest 2018​ C. Coolest Ski Route

    John loves winter. Every skiing season he goes heli-skiing with his friends. To do so, they rent a h ...

  2. German Collegiate Programming Contest 2018​ A. Attack on Alpha-Zet

    题目链接https://nanti.jisuanke.com/t/28852 题目大意是 h*w 的平面,每两个点有且仅有一条路径,类似于封闭的联通空间,然后在这h*w个点中选取(标记为1~N)N个点 ...

  3. German Collegiate Programming Contest 2018​

    // Coolest Ski Route #include <iostream> #include <cstdio> #include <cstring> #inc ...

  4. 2018 German Collegiate Programming Contest (GCPC 18)

    2018 German Collegiate Programming Contest (GCPC 18) Attack on Alpha-Zet 建树,求lca 代码: #include <al ...

  5. (寒假GYM开黑)2018 German Collegiate Programming Contest (GCPC 18)

    layout: post title: 2018 German Collegiate Programming Contest (GCPC 18) author: "luowentaoaa&q ...

  6. ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2018) Syria, Lattakia, Tishreen University, April, 30, 2018

    ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2018) Syr ...

  7. (寒假开黑gym)2017-2018 ACM-ICPC German Collegiate Programming Contest (GCPC 2017)

    layout: post title: (寒假开黑gym)2017-2018 ACM-ICPC German Collegiate Programming Contest (GCPC 2017) au ...

  8. German Collegiate Programming Contest 2015 计蒜课

    // Change of Scenery 1 #include <iostream> #include <cstdio> #include <algorithm> ...

  9. 2017-2018 ACM-ICPC German Collegiate Programming Contest (GCPC 2017)(9/11)

    $$2017-2018\ ACM-ICPC\ German\ Collegiate\ Programming\ Contest (GCPC 2017)$$ \(A.Drawing\ Borders\) ...

随机推荐

  1. windows 安装 jdk1.8并配置环境变量

    1.查看电脑环境 我的电脑--右键--属性 2.下载jdk1.8 网址:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-do ...

  2. sql语句优化及后一条减前一条

    sql语句优化: 1.表加索引 2.少用like,直接用=所有值 3.where语句把能大量筛查的条件写在前面 4.数据量大时,参与计算的值相同时只取一条 后一条减前一条, select houec, ...

  3. 关于UITableView的性能优化(历上最全面的优化分析)

    (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath ...

  4. Js中的字符串/数组中常用的操作

    JS为每种数据类型都内置很多方法,真的不好记忆,而且有些还容易记混,现整理如下,以便以后查看: 一.String ①charAt()方法用于返回指定索引处的字符.返回的字符是长度为 1 的字符串. 语 ...

  5. edittext 设置不自动获取焦点

    给父级控件 设置两个属性,可以把焦点抢夺过去,最好是没有任何事件的父级控件(本人比较喜欢在xml文件的跟布局设置,因为页面的跟布局一般情况下,是不会设置任何事件的) android:focusable ...

  6. 【Troubleshooting Case】Exchange Server 组件状态应用排错?

    在Exchange 2013中,引入了“服务器组件状态”的概念.服务器组件状态从运行环境的角度提供对组成Exchange Server的组件的状态的精细控制. 日常排错时,常常会把Exchange 服 ...

  7. Python中的绝对路径和相对路径

    大牛们应该对路径都很了解了,这篇文章主要给像我这样的入门小白普及常识用的,啊哈 下面的路径介绍针对windows,其他平台的暂时不是很了解. 在编写的py文件中打开文件的时候经常见到下面其中路径的表达 ...

  8. Xamarin 常见问题解决方案汇总

    出现如下提示,错误: 找不到或无法加载主类 com.sun.tools.javac.MainMSB6006: 或 閿欒: 绋嬪簭鍖卆ndroid.support.v4.view.ViewPager涓嶅 ...

  9. CCCC 以及 hihocoder offer收割赛11 ~~~

    CCCC  真的很蒙  ,没有队服,没有狗牌,服务器崩溃到14:10  才开始比赛...(黑人问号 开始前,发现旁边是西交老大吴航,mad~各种紧张.看着大佬疯狂的敲宏定义就很怕啊.100多行,一行头 ...

  10. UI的组织形式

    UI的组织形式是树状结构: 根据层次的不同分为叶子节点和干节点. 叶子节点负责简单的信息展示. 复杂的主干复杂叶子节点的组织和整体展示. http://www.cnblogs.com/feng9exe ...