题目链接:

B - Battle Royale

 Gym - 102021B

题目大意:给你两个坐标,表示起点和终点,然后给你两个圆,第一个圆包含两个圆,然后问你起点到终点的最短距离(不经过第二个圆)。

具体思路:首先求出第一个点到圆的切点之间的距离,然后求出第二个点到圆的切点之间的距离,再加上那一段圆弧的长度,就是最短距离。

这个题弧度转换成角度的话,会损失精度,可以直接利用弧度进行计算,弧度计算长度,(角度/(2*pi))*2*pi*r.

 #include<bits/stdc++.h>
using namespace std;
# define ll long long
# define inf 0x3f3f3f3f
const double pi = acos(-1.0);
const int maxn = 2e6+;
double dis(double x1,double y1,double x2,double y2)
{
return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
int main()
{
double xc,yc;
double xd,yd,xb,yb,rb,xr,yr,rr;
scanf("%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf",&xc,&yc,&xd,&yd,&xb,&yb,&rb,&xr,&yr,&rr);
double l1=dis(xc,yc,xr,yr),l2=dis(xd,yd,xr,yr),l3=dis(xc,yc,xd,yd);
double o1=acos(rr/l1);
double o2=acos(rr/l2);
double tmp=acos((l1*l1+l2*l2-l3*l3)/(2.0*l1*l2));
double s=((tmp-o1-o2))*rr;
double ans=sqrt(l1*l1-rr*rr)+sqrt(l2*l2-rr*rr)+s;
cout<<fixed<<setprecision()<<ans<<endl;
return ;
}

 

Problem B: Battle Royale(简单几何)的更多相关文章

  1. You can Solve a Geometry Problem too (hdu1086)几何,判断两线段相交

    You can Solve a Geometry Problem too Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/3276 ...

  2. Python下opencv使用笔记(二)(简单几何图像绘制)

    简单几何图像一般包含点.直线.矩阵.圆.椭圆.多边形等等.首先认识一下opencv对像素点的定义. 图像的一个像素点有1或者3个值.对灰度图像有一个灰度值,对彩色图像有3个值组成一个像素值.他们表现出 ...

  3. German Collegiate Programming Contest 2018​ B. Battle Royale

    Battle Royale games are the current trend in video games and Gamers Concealed Punching Circles (GCPC ...

  4. Codeforces 935 简单几何求圆心 DP快速幂求与逆元

    A #include <bits/stdc++.h> #define PI acos(-1.0) #define mem(a,b) memset((a),b,sizeof(a)) #def ...

  5. 简单几何(线段相交) POJ 2826 An Easy Problem?!

    题目传送门 题意:两条线段看成两块木板,雨水从上方往下垂直落下,问能接受到的水的体积 分析:恶心的分类讨论题,考虑各种情况,尤其是入口被堵住的情况,我的方法是先判断最高的两个点是否在交点的同一侧,然后 ...

  6. hdu Train Problem I(栈的简单应用)

    Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot o ...

  7. 简单几何(线段相交) POJ 2653 Pick-up sticks

    题目传送门 题意:就是小时候玩的一种游戏,问有多少线段盖在最上面 分析:简单线段相交,队列维护当前最上的线段 /******************************************** ...

  8. fzu Problem 2148 Moon Game(几何 凸四多边形 叉积)

    题目:http://acm.fzu.edu.cn/problem.php?pid=2148 题意:给出n个点,判断可以组成多少个凸四边形. 思路: 因为n很小,所以直接暴力,判断是否为凸四边形的方法是 ...

  9. osg for android (一) 简单几何物体的加载与显示

    1. 首先需要一个OSG for android的环境. (1).NDK 现在Eclipse 对NDK已经相当友好了,已经不需要另外cygwin的参与,具体可以参考 Android NDK开发篇(一) ...

随机推荐

  1. web框架开发-Django用户认证组件

    可以用认证组件做什么 针对session的缺陷, 跟新数据时,不跟新key键, 用户认证组件是删除后再重建 用户认证组件很多功能可以直接使用 利用用户认证表(auth_user,通过Django自己创 ...

  2. JetBrains 全套激活 Pycharm Clion 高校学生老师免费用

    https://www.jetbrains.com/store/?fromMenu#edition=discounts https://www.jetbrains.com/zh/student/ 用高 ...

  3. Android测试(四):Instrumented 单元测试

    原文:https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests.html Instrume ...

  4. docker 搭建 Telegram Messenger MTP

    docker hub官方镜像地址如下: https://hub.docker.com/r/telegrammessenger/proxy 拉取镜像 sudo docker pull telegramm ...

  5. 分治FFT的三种含义

    分治FFT是几个算法的统称.它们之间并无关联. 分治多项式乘法 问题如求\(\prod_{i=1}^na_ix+b\). 若挨个乘复杂度为\(O(n^2\log n)\),可分治做这件事,复杂度为\( ...

  6. Binary Search(Java)(非递归)

    public static int rank(int[] array, int k) { int front = 0, rear = array.length - 1; while(front < ...

  7. sublime 官方正版,自己用的插件配置,最轻量级安装流程

    到了一家新公司,新的办公电脑,移动工作站哦,配置很酷.需要自己安装编码环境,node.js(http-server)是必须要装的,编辑器个人比较喜欢sublime,现在归纳一下配置流程,ps:本人有点 ...

  8. Python——Pycharm安装、激活、中文、

    1.激活pycharm (1) 修改hosts文件:将  0.0.0.0 account.jetbrains.com   添加到文件最后面   Windows系统hosts文件路径为:  c:\win ...

  9. codeforces479E

    Riding in a Lift CodeForces - 479E Imagine that you are in a building that has exactly n floors. You ...

  10. Day 3 下午

    依旧是组合数问题 先来看一道题 如图,一个n*m的方格中,从原点开始,每次只能向上走或者向右走,求走到点(n,m)共有多少种走法 一般做法: 一个一个写,每一个节点的种数=它左边的数量+右边的数量 显 ...