hdu---(Tell me the area)(几何/三角形面积以及圆面积的一些知识)
Tell me the area
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1876 Accepted Submission(s): 567
are two circles in the plane (shown in the below picture), there is a
common area between the two circles. The problem is easy that you just
tell me the common area.

are many cases. In each case, there are two lines. Each line has three
numbers: the coordinates (X and Y) of the centre of a circle, and the
radius of the circle.
each case, you just print the common area which is rounded to three
digits after the decimal point. For more details, just look at the
sample.
2 2 1
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std; struct circle
{
double x,y,r;
};
double dist(circle a,circle b)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int main()
{
circle a,b;
double d,p,area,sb,sa;
while(scanf("%lf%lf%lf%lf%lf%lf",&a.x,&a.y,&a.r,&b.x,&b.y,&b.r)!=EOF)
{
d=dist(a,b);
double rr=min(a.r,b.r);
if(d<=abs(a.r-b.r)) //内含或者内切
area=acos(-1.0)*rr*rr;
else
if(d>=a.r+b.r)
area=0.0;
else{
p=(a.r+b.r+d)/2.0;
sa=acos((a.r*a.r+d*d-b.r*b.r)/(2.0*a.r*d));
sb=acos((b.r*b.r+d*d-a.r*a.r)/(2.0*b.r*d));
area=sa*a.r*a.r+sb*b.r*b.r-*sqrt(p*(p-a.r)*(p-b.r)*(p-d));
}
printf("%.3lf\n",area);
}
return ;
}
hdu---(Tell me the area)(几何/三角形面积以及圆面积的一些知识)的更多相关文章
- hdu 4709:Herding(叉积求三角形面积+枚举)
Herding Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Sub ...
- Leetcode812.Largest Triangle Area最大三角形面积
给定包含多个点的集合,从其中取三个点组成三角形,返回能组成的最大三角形的面积. 示例: 输入: points = [[0,0],[0,1],[1,0],[0,2],[2,0]] 输出: 2 解释: 这 ...
- Maximal Area Quadrilateral CodeForces - 340B || 三点坐标求三角形面积
Maximal Area Quadrilateral CodeForces - 340B 三点坐标求三角形面积(可以带正负,表示向量/点的不同相对位置): http://www.cnblogs.com ...
- 【BZOJ1845】[Cqoi2005] 三角形面积并 几何+扫描线
[BZOJ1845][Cqoi2005] 三角形面积并 Description 给出n个三角形,求它们并的面积. Input 第一行为n(N < = 100), 即三角形的个数 以下n行,每行6 ...
- (hdu step 7.1.6)最大三角形(凸包的应用——在n个点中找到3个点,它们所形成的三角形面积最大)
题目: 最大三角形 Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...
- ytu 1058: 三角形面积(带参的宏 练习)
1058: 三角形面积 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 190 Solved: 128[Submit][Status][Web Boar ...
- UVa 11437:Triangle Fun(计算几何综合应用,求直线交点,向量运算,求三角形面积)
Problem ATriangle Fun Input: Standard Input Output: Standard Output In the picture below you can see ...
- TZOJ 2519 Regetni(N个点求三角形面积为整数总数)
描述 Background Hello Earthling. We're from the planet Regetni and need your help to make lots of mone ...
- hdu 2034 改革春风吹满地 多边形面积
改革春风吹满地 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem ...
随机推荐
- [Gym]2008-2009 ACM-ICPC, NEERC, Moscow Subregional Contest
比赛链接:http://codeforces.com/gym/100861 A模拟,注意两个特殊的缩写. #include <bits/stdc++.h> using namespace ...
- 【转】利用Pspice分析放大器环路的稳定性
文章来源: http://www.21ic.com/app/test/201108/90808.htm 虽然在较低频率下可以较轻松地检查一个简单放大器的稳定性,但评估一个较为复杂的电路是否稳定,难度可 ...
- 纯CSS写三角形-border法
(1)有边框的三角形 我们来写下带边框的三角形. 如果是一个正方形,我们写边时,会用到border,但我们这里讨论的三角形本身就是border,不可能再给border添加border属性,所以我们需要 ...
- Messages消息处理
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- 苹果原生NSURLSession的上传和下载
关于NSURLSession的上传和下载 在iOS7.0后,苹果公司新推出了一个NSURLSession来代替NSURLConnection.NSURLConnection默认是在 主线程执行的.而N ...
- Base64加密解密原理以及代码实现(VC++)
Base64加密解密原理以及代码实现 转自:http://blog.csdn.net/jacky_dai/article/details/4698461 1. Base64使用A--Z,a--z,0- ...
- hiho #1050 : 树中的最长路 树的直径
#1050 : 树中的最长路 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 上回说到,小Ho得到了一棵二叉树玩具,这个玩具是由小球和木棍连接起来的,而在拆拼它的过程中, ...
- bzoj 2957: 楼房重建 线段树
2957: 楼房重建 Time Limit: 10 Sec Memory Limit: 256 MB[Submit][Status][Discuss] Description 小A的楼房外有一大片施 ...
- perl的map函数
perl的map函数的使用: 语法 map EXPR, LIST map BLOCK LIST 定义和使用 对list中的每个元素执行EXPR或BLOCK,返回新的list.对每一此迭代,$_中保存了 ...
- c 字符串常用函数
#include <iostream> #include <stdio.h> #include <vector> #include "string.h&q ...