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. 滚动条美化插件 nicescroll

    这个插件使用起来非常简单,首先下载插件jquery.nicescroll.min.js 然后在页面中引入jquery,再引入这个插件, 然后在页面中需要修改滚动条的地方,例如id为box的div &l ...

  2. JavaWeb_03_JavaScript学习小结1

    1.javascript的简介 是基于对象和事件驱动的语言,应用于客户端. 基于对象: 提供好了很多对象,可以直接拿过来使用 事件驱动: html做网站静态效果,javascript动态效果 客户端: ...

  3. win7 dos窗口模拟帧刷新

    前几天是白色情人节,临时脑抽写了个表白神器 高端大气上档次,就是不知道该送给谁,经过两天的反射弧思考决定还是写给博客娘吧.- -~ 这个程序就是打开后,在Dos窗口内模拟写出几行字母.其实主要就是模拟 ...

  4. JavaSe-算数运算符

    算数运算符包括:+.-.*./.%.++.-- 代码: package com.java.chap02; public class Demo07 { public static void main(S ...

  5. POJ 2411 Mondriaan's Dream (状压DP,骨牌覆盖,经典)

    题意: 用一个2*1的骨牌来覆盖一个n*m的矩形,问有多少种方案?(1<=n,m<=11) 思路: 很经典的题目,如果n和m都是奇数,那么答案为0.同uva11270这道题. 只需要m个b ...

  6. 【Python图像特征的音乐序列生成】思路的转变

    关于生成网络这边,可能会做一个深度的受限玻尔兹曼机,这样可以保证生成的音乐不会太相似. 情绪识别网络和生成网络的耦合,中间变量可能直接就是一个one-hot向量,用来标注指定的情绪,不做成坐标那种难以 ...

  7. 【Python图像特征的音乐序列生成】关于数据库到底在哪里下载

    毕竟原网站一个是14年前的一个是16年前的…… 1,http://ifdo.ca/~seymour/nottingham/nottingham.html 这个网站可以下载zip包. 2,https:/ ...

  8. 日常-acm-三位数反转

    输入一个三位数,分理出它的百位,十位和个位,反转后输出. 样例输入: 127 样例输出: 721 tips:注意最后一位为0的情况,如360,输出063 #include <iostream&g ...

  9. coreData-Fetching Managed Objects

    https://developer.apple.com/library/content/documentation/DataManagement/Conceptual/CoreDataSnippets ...

  10. 剑指offer58 二叉树的下一个结点

    自己写的 class Solution { public: TreeLinkNode* GetNext(TreeLinkNode* pNode) { if(pNode == NULL) return ...