UVA 10209 Is This Integration ?

本文探讨了基于特定几何形状(如正方形、等边三角形)的面积计算方法,具体涉及如何通过计算等边三角形面积、正方形面积及相关几何元素(扇形区域)来确定复杂形状区域的总面积。详细步骤包括利用正方形边长计算面积、等边三角形面积以及扇形区域面积,最终得出不同形状区域的总面积。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Problem C
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
 
解法,先弄一个等边三角形出来,AE=BE=AB.然后就把正方形面积-等边三角形-2个k的面积(k即使两个小扇形)
注意 Pi的大小定义成acos(-1)  3.1415926不精确!!!!
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#define Pi acos(-1)
using namespace std;
int main()
{
	double a;
	while (~scanf("%lf",&a))
	{
		double s=0,x,y,z;
		s=sqrt(3.0)*a*a/4.0+Pi*a*a/6.0;
		z=4*(a*a-s);
		y=4*(a*a-Pi*a*a/4-z/2);
		x=a*a-z-y;
		printf("%.3lf %.3lf %.3lf\n",x,y,z);
	}
	return 0;
}

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值