HDU 1798 Tell me the area
http://acm.hdu.edu.cn/showproblem.php?pid=1798

代码:
#include <bits/stdc++.h>
using namespace std; int main() {
double x1, y1, r1, x2, y2, r2, minr, maxr, d, ans;
while(~scanf("%lf%lf%lf", &x1, &y1, &r1)) {
scanf("%lf%lf%lf", &x2, &y2, &r2);
d = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
minr = min(r1, r2);
maxr = max(r1, r2);
if(d <= maxr - minr)
ans = acos(-1.0) * minr * minr;
else if(d >= r1 + r2)
ans = 0;
else {
double a1, a2;
double p;
p = (r1 + r2 + d) / 2;
a1 = acos((r1 * r1 + d * d - r2 * r2) / (2 * r1 * d));
a2 = acos((r2 * r2 + d * d - r1 * r1) / (2 * r2 * d));
ans = a1 * r1 * r1 + a2 * r2 * r2 - 2 * sqrt(p * (p - r1) * (p - r2) * (p - d));
}
printf("%.3f\n", ans);
}
return 0;
}
HDU 1798 Tell me the area的更多相关文章
- HDU 1798 Tell me the area (数学)
题目链接 Problem Description There are two circles in the plane (shown in the below picture), there ...
- NOIP模拟赛10
T1 [HAOI2010]软件安装 https://daniu.luogu.org/problem/show?pid=2515 树上背包,如果有i必须有j,j作为i的父节点 O(nm²) #inclu ...
- hdu 2528 Area
2014-07-30 http://acm.hdu.edu.cn/showproblem.php?pid=2528解题思路: 求多边形被一条直线分成两部分的面积分别是多少.因为题目给的直线一定能把多边 ...
- hdu 2892 Area
http://acm.hdu.edu.cn/showproblem.php?pid=2892 解题思路: 求多边形与圆的相交的面积是多少. 以圆心为顶点,将多边形划分为n个三角形. 接下来就求出每个三 ...
- hdu 4946 Area of Mushroom(凸包)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4946 Area of Mushroom Time Limit: 2000/1000 MS (Java/Ot ...
- HDU 1071 The area(求三个点确定的抛物线的面积,其中一个点是顶点)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1071 The area Time Limit: 2000/1000 MS (Java/Others) ...
- HDU 4946 Area of Mushroom(构造凸包)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4946 题目大意:在一个平面上有n个点p1,p2,p3,p4....pn,每个点可以以v的速度在平面上移 ...
- HDU 4946 Area of Mushroom 凸包
链接:pid=4946">http://acm.hdu.edu.cn/showproblem.php?pid=4946 题意:有n个人.在位置(xi,yi),速度是vi,假设对于某个点 ...
- HDU 4946 Area of Mushroom 凸包 第八次多校
题目链接:hdu 4946 题意:一大神有N个学生,各个都是小神,大神有个二次元空间,每一个小神都有一个初始坐标,如今大神把这些空间分给徒弟们,规则是假设这个地方有一个人比谁都先到这,那么这个地方就是 ...
随机推荐
- iOS 从0到1搭建高可用App框架
iOS 从0到1搭建高可用App框架 最近在搭建新项目的iOS框架,一直在思考如何才能搭建出高可用App框架,能否避免后期因为代码质量问题的重构.以前接手过许多“烂代码”,架构松散,底层混乱,缺少规范 ...
- 给xcode项目重命名
在xcode项目开发中,经常会遇到需要修改项目名字的问题, 但是xcode本身修改项目名字比较麻烦,有时候修改的不完全,有时候修改了项目无法打开,无奈只能建一个新项目.这里提供一种修改xcode项目名 ...
- JetBrains 授权服务器(License Server):
JetBrains 授权服务器(License Server): https://www.imsxm.com/jetbrains-license-server.html
- VS2013入门驱动配置测试
准备工作: VS2013 WDK8.1 DbgView InstDrv VS2013+WDK8.1是绝配,意思是这两个版本结合最方便,安装后无需任何改动直接写代码,自动生成模板,省去了设置一些参数繁琐 ...
- 小程序登录 -41003: aes 小程序加密数据解密失败问题
在微信小程的开发中,登录问题,一定要按照这样的顺序 1. 小程序请求login,拿到code 然后传给服务端: 2.服务端拿到code 到微信服务器拿到sessionKey :3.然后小程序调用ge ...
- httpd的prefork、worker、event
Apache(httpd) 有3种核心MPM(Multi-Processing Module,多进程处理模块)工作模式,分别是prefork,worker和event,其中httpd-2.2的even ...
- isolate-user-vlan隔离用户vlan的配置
lab1 根据项目需求搭建好拓扑图: 首先,配置sw2,在E0/4/0接口上创建vlan20,并将该vlan接口配置成带有ip地址的类以太接口 其次,在E0/4/1接口上加入vlan2,同理,E0/4 ...
- 分享一个PC端六格密码输入框写法
如图.我们一般做商城类的项目不免会用到支付密码输入框,我研究了下并决定发上来,也当作是自己成长路上的一点小小的记录.本次介绍的是基于vue的项目 html: <template> < ...
- laravel构造函数跳转失败
<?php namespace App\Http\Controllers\Admin; use Illuminate\Http\Request; use App\Http\Requests;us ...
- Python的Bottle框架中实现最基本的get和post的方法的教程
这篇文章主要介绍了Python的Bottle框架中实现最基本的get和post的方法的教程,Bottle框架在Python开发者中的人气很高,需要的朋友可以参考下 1.GET方式: # -*- cod ...