German Collegiate Programming Contest 2018 B. Battle Royale
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的更多相关文章
- 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 ...
- German Collegiate Programming Contest 2018 A. Attack on Alpha-Zet
题目链接https://nanti.jisuanke.com/t/28852 题目大意是 h*w 的平面,每两个点有且仅有一条路径,类似于封闭的联通空间,然后在这h*w个点中选取(标记为1~N)N个点 ...
- German Collegiate Programming Contest 2018
// Coolest Ski Route #include <iostream> #include <cstdio> #include <cstring> #inc ...
- 2018 German Collegiate Programming Contest (GCPC 18)
2018 German Collegiate Programming Contest (GCPC 18) Attack on Alpha-Zet 建树,求lca 代码: #include <al ...
- (寒假GYM开黑)2018 German Collegiate Programming Contest (GCPC 18)
layout: post title: 2018 German Collegiate Programming Contest (GCPC 18) author: "luowentaoaa&q ...
- 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 ...
- (寒假开黑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 ...
- German Collegiate Programming Contest 2015 计蒜课
// Change of Scenery 1 #include <iostream> #include <cstdio> #include <algorithm> ...
- 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\) ...
随机推荐
- jsfiddle.net上的记录
1.JQuery: http://jsfiddle.net/uryc1908/ 2.e-chart: http://jsfiddle.net/8fq96a7s/ 3.easyUI http://jsf ...
- Python踩坑之旅其二裸用os.system的原罪
目录 1.1 踩坑案例 1.2 填坑解法 1.3 坑位分析 1.4.1 技术关键字 1.5 填坑总结 2. 前坑回顾 2.1 Linux中, 子进程拷贝父进程哪些信息 2.2 Agent常驻进程选择& ...
- setTimeout() 实现程序每隔一段时间自动执行
定义和用法 setTimeout() 方法用于在指定的毫秒数后调用函数或计算表达式. 语法 setTimeout(code,millisec) 参数 描述 code 必需.要调用的函数后要执行的 Ja ...
- [USACO07JAN]平衡的阵容Balanced Lineup
[USACO07JAN]平衡的阵容Balanced Lineup 题目描述 For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) a ...
- java实现xml文件读取并保存到对象
首先浅聊一下解析xml的四种方式: 1.DOM方式:有缺点但是这个缺点却也是他的优点.下面详细介绍: 以树形的层次结构组织节点或信息片断集合,可以获得同一个文档中的多处不同数据.使用起来简单. 优点是 ...
- UIcollectionView 实现 轮番图
UICollectionView 用作轮番图的实现,demo 地址:https://github.com/SummerHH/YJCYCleCollectionVIew #import <UIKi ...
- java读取文件封装的一个类(有部分代码借鉴别人的)
package modbus.rtu.calc; import java.io.BufferedReader; import java.io.FileInputStream; import java. ...
- springboot集成shiro实现权限认证
github:https://github.com/peterowang/shiro 基于上一篇:springboot集成shiro实现身份认证 1.加入UserController package ...
- Beta_版本发布
学号 姓名 201731041215 王阳 201731062302 鲜雨珂 201731062128 邓捷 201731062305 周蓉 201731062131 龙继平 201731062304 ...
- Nginx服务器301跳转到带www的域名的方法
为什么要这么做? 我们的域名在做解析时经常会解析2个域名,即带www的和不带www的.这样做的目的是,当用户使用不带www的域名时,也可以正常访问你的网站.但是这样做的后果是,你站点主域名的PR值分散 ...