HDU 5858 Hard problem 2016多校10 1002 [相交圆面积]【计算几何】
2016-08-19 16:04
447 查看
题目连接 : 就当前HDU的情况 就先不给了
——————————————————————–.
Hard problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 195 Accepted Submission(s): 148
Problem Description
cjj is fun with math problem. One day he found a Olympic Mathematics problem for primary school students. It is too difficult for cjj. Can you solve it?
![](http://acm.split.hdu.edu.cn/data/images/C713-1002-1.jpg)
Give you the side length of the square L, you need to calculate the shaded area in the picture.
The full circle is the inscribed circle of the square, and the center of two quarter circle is the vertex of square, and its radius is the length of the square.
Input
The first line contains a integer T(1<=T<=10000), means the number of the test case. Each case contains one line with integer l(1<=l<=10000).
Output
For each test case, print one line, the shade area in the picture. The answer is round to two digit.
Sample Input
1
1
Sample Output
0.29
———————————————-.
题目大意 : 就是正方形边长为n时 求阴影面积 保留小数后两位
题目分析 :
当天不想做多校 然后队友给看了这题 说是小学奥数题目 所以就一直割补法 然后 GG
今天偶然看了看过去整理的模板 猛然看到一个叫做相交圆面积的东西 然后就想到了这道题目。。
然后大致是这样的。
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/05/7c5d47e1f672ad7ad48352c4c224b1ec)
小的圆是蓝的 打的圆是红的 绿色部分是相交的面积 (红色+蓝色==绿色?就当是对的了:不可能错)
然后根据相交圆面积求绿色部分 最后拿小圆的面积减去它 最后在乘个二就行了。。。
之后做题的时候只求一次边长为1的阴影部分面价就好了 因为平面图形 等比放大N倍 面积就是原来的n*n倍
#
就是这么水 然而被第一句话误导了 一直在寻找巧妙的办法…
什么小学奥数题目。。。 小学能学这个??!!!
附本题代码
———————————————–.
——————————————————————–.
Hard problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 195 Accepted Submission(s): 148
Problem Description
cjj is fun with math problem. One day he found a Olympic Mathematics problem for primary school students. It is too difficult for cjj. Can you solve it?
![](http://acm.split.hdu.edu.cn/data/images/C713-1002-1.jpg)
Give you the side length of the square L, you need to calculate the shaded area in the picture.
The full circle is the inscribed circle of the square, and the center of two quarter circle is the vertex of square, and its radius is the length of the square.
Input
The first line contains a integer T(1<=T<=10000), means the number of the test case. Each case contains one line with integer l(1<=l<=10000).
Output
For each test case, print one line, the shade area in the picture. The answer is round to two digit.
Sample Input
1
1
Sample Output
0.29
———————————————-.
题目大意 : 就是正方形边长为n时 求阴影面积 保留小数后两位
题目分析 :
当天不想做多校 然后队友给看了这题 说是小学奥数题目 所以就一直割补法 然后 GG
今天偶然看了看过去整理的模板 猛然看到一个叫做相交圆面积的东西 然后就想到了这道题目。。
然后大致是这样的。
小的圆是蓝的 打的圆是红的 绿色部分是相交的面积 (红色+蓝色==绿色?就当是对的了:不可能错)
然后根据相交圆面积求绿色部分 最后拿小圆的面积减去它 最后在乘个二就行了。。。
之后做题的时候只求一次边长为1的阴影部分面价就好了 因为平面图形 等比放大N倍 面积就是原来的n*n倍
#
就是这么水 然而被第一句话误导了 一直在寻找巧妙的办法…
什么小学奥数题目。。。 小学能学这个??!!!
附本题代码
———————————————–.
#include <bits/stdc++.h> using namespace std; #define lalal puts("*******"); const double PI = acos(-1); struct Round { double x, y; double r; }c1,c2; double dis(Round a, Round b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } double solve(Round a, Round b) { double d = dis(a, b); if (d >= a.r + b.r) return 0; if (d <= fabs(a.r - b.r)) { double r = a.r < b.r ? a.r : b.r; return PI * r * r; } double ang1 = acos((a.r * a.r + d * d - b.r * b.r) / 2. / a.r / d); double ang2 = acos((b.r * b.r + d * d - a.r * a.r) / 2. / b.r / d); double ret = ang1 * a.r * a.r + ang2 * b.r * b.r - d * a.r * sin(ang1); return ret; } int main() { c1.x=0.0,c1.y=0.0,c1.r=1.0; c2.x=0.5,c2.y=0.5,c2.r=0.5; double s = solve(c1,c2); s = PI*0.5-s*2; // printf("%.15lf\n",s); int _,n; scanf("%d",&_); while(_--) { scanf("%d",&n); printf("%.2lf\n",s*n*n); } return 0; }
相关文章推荐
- hdu 3264 09 宁波 现场 E - Open-air shopping malls 计算几何 二分 圆相交面积 难度:1
- HDU 1798 Tell me the area(计算几何,求相交圆面积)
- HDU 3264 Open-air shopping malls [相交圆面积+二分查找]【计算几何】
- HDU 3264 Open-air shopping malls (计算几何-圆相交面积)
- 计算几何 ( 求两圆相交面积 )——Open-air shopping malls ( HDU 3264 )
- hdu 3264 Open-air shopping malls 计算几何 相交圆的面积 二分
- hdoj.2892 area【计算几何+圆与多边形相交面积】 2015/08/17
- HDU 1147 Pick-up sticks(计算几何 判断直线相交)
- hdu 3685 10 杭州 现场 F - Rotational Painting 重心 计算几何 难度:1
- hdu 1086:You can Solve a Geometry Problem too(计算几何,判断两线段相交,水题)
- Educational Codeforces Round 2D. Area of Two Circles' Intersection(计算几何+圆相交的面积)
- HDU 3103 Shoring Up the Levees(计算几何 求面积)
- HDU 5130 Signal Interference --计算几何,多边形与圆的交面积
- POJ 2546 Circular Area [相交园面积]【计算几何】
- HDU-5120-Intersection【几何-相交圆面积】
- hdu 5130 Signal Interference(计算几何+圆与多边形交的面积)
- HDU 4667 Building Fence(2013多校7 1002题 计算几何,凸包,圆和三角形)
- 【计算几何初步-线段相交】【HDU1089】线段交点
- hdoj Intersection 5120 (数学计算几何) 求两个相交圆的面积
- hdoj.4404 Worms【计算几何+圆与多边形相交面积】 2015/08/17