UVa 10209 Is This Integration ?(计算几何)
2014-07-29 23:34
309 查看
Is This Integration ?
Input: Standard Input
Output: Standard Output
Time Limit: 3 seconds
In the image below you can see a square ABCD, where AB = BC = CD = DA = a. Four arcs are drawn taking the four vertexes A, B, C, D as centers and a as the radius. The arc that is drawn taking A as
center, starts at neighboring vertex B and ends at neighboring vertex D. All other arcs are drawn in a similar fashion. Regions of three different shapes are created in this fashion. You will have to determine the total area
if these different shaped regions.
Input
The input file contains a floating-point number a (a>=0 a<=10000) in each line which indicates the length of one side of the square. Input is terminated by end of file.
Output
For each line of input, output in a single line the total area of the three types of region (filled with different patterns in the image above). These three numbers will of course be floating point numbers with three digits after the decimal point. First
number will denote the area of the striped region, the second number will denote the total area of the dotted regions and the third number will denote the area of the rest of the regions.
Sample Input:
0.1
0.2
0.3
Sample Output:
0.003 0.005 0.002
0.013 0.020 0.007
0.028 0.046 0.016
题目大意:
给定正方形的变长a,分别求出三种阴影部分的面积。
解题思路:
关键在于添加辅助线,求出z的面积(等于正方形面积 减去 2个扇形面积 和 1个等边三角形面积)。
参考代码:
Input: Standard Input
Output: Standard Output
Time Limit: 3 seconds
In the image below you can see a square ABCD, where AB = BC = CD = DA = a. Four arcs are drawn taking the four vertexes A, B, C, D as centers and a as the radius. The arc that is drawn taking A as
center, starts at neighboring vertex B and ends at neighboring vertex D. All other arcs are drawn in a similar fashion. Regions of three different shapes are created in this fashion. You will have to determine the total area
if these different shaped regions.
Input
The input file contains a floating-point number a (a>=0 a<=10000) in each line which indicates the length of one side of the square. Input is terminated by end of file.
Output
For each line of input, output in a single line the total area of the three types of region (filled with different patterns in the image above). These three numbers will of course be floating point numbers with three digits after the decimal point. First
number will denote the area of the striped region, the second number will denote the total area of the dotted regions and the third number will denote the area of the rest of the regions.
Sample Input:
0.1
0.2
0.3
Sample Output:
0.003 0.005 0.002
0.013 0.020 0.007
0.028 0.046 0.016
题目大意:
给定正方形的变长a,分别求出三种阴影部分的面积。
解题思路:
关键在于添加辅助线,求出z的面积(等于正方形面积 减去 2个扇形面积 和 1个等边三角形面积)。
参考代码:
#include <iostream> #include <iomanip> #include <cmath> using namespace std; const double PI = acos(-1.0); double a, A, B, C; int main() { ios::sync_with_stdio(false); while (cin >> a) { A = (1.0 - sqrt(3) + PI / 3.0) * a*a; B = (-4.0 + 2.0*sqrt(3) + PI / 3.0) * a*a; C = (4.0 - sqrt(3) - 2.0 / 3.0 * PI) * a*a; cout << fixed << setprecision(3) << A << " " << B << " " << C << endl; } return 0; }
相关文章推荐
- uva 10209 Is This Integration ? (计算几何)
- uva 10209 Is This Integration ? (计算几何)
- UVa 10209 - Is This Integration ?
- UVa 10209 - Is This Integration ?
- UVA 10209 - Is This Integration
- UVA 10209(Is This Integration ?-容斥原理)
- UVa Problem 10209 Is This Integration? (需要积分吗?)
- UVa 10012 How Big is It? (计算几何+DFS)
- UVa 12714 Two Points Revisited (水题,计算几何)
- UVa 11437:Triangle Fun(计算几何综合应用,求直线交点,向量运算,求三角形面积)
- UVa 10256 (计算几何基础摸板)
- 计算几何专项:UVa 754
- UVA 12304 2D Geometry 110 in 1!(计算几何)
- UVA 11800 - Determine the Shape(计算几何)
- 计算几何专项:UVa 10585
- UVALive 5908 Tracking RFIDs 【计算几何】
- UVa343 What Base Is This
- UVALive7749(Convex Contour)-计算几何分类讨论
- UVA 12300 - Smallest Regular Polygon(计算几何)
- UVA 10652 Board Wrapping 计算几何