uva 10209 Is This Integration ? (计算几何)

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, Das 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


Shahriar Manzoor

题目大意:

告诉你正方形的面积,求不同颜色的阴影部分的面积。

解题思路:

设各块面积为x,y,z,建立三个方程即可求解。

解题代码:

#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

const double pi=acos(-1);

int main(){
    double a;
    while(cin>>a){
        double z=a*a-pi*a*a/6.0-sqrt(3)/4.0*a*a;
        double y=a*a-pi*a*a/4.0-2.0*z;
        double x=a*a-4.0*y-4.0*z;
        printf("%.3lf %.3lf %.3lf\n",x,4*y,4*z);
    }
    return 0;
}

uva 10209 Is This Integration ? (计算几何)

时间: 2024-08-30 02:44:19

uva 10209 Is This Integration ? (计算几何)的相关文章

UVA 11178 Morley&#39;s Theorem 计算几何

计算几何: 最基本的计算几何,差积  旋转 Morley's Theorem Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu Submit Status Description Problem D Morley's Theorem Input: Standard Input Output: Standard Output Morley's theorem states that that the line

uva 11796 Dog Distance (计算几何-点和直线)

C Dog Distance Input Standard Input Output Standard Output Two dogs, Ranga and Banga, are running randomly following two different paths. They both run for T seconds with different speeds. Ranga runs with a constant speed of R m/s, whereas Banga runs

uva 10652 Board Wrapping (计算几何-凸包)

Problem B Board Wrapping Input: standard input Output: standard output Time Limit: 2 seconds The small sawmill in Mission, British Columbia, has developed a brand new way of packaging boards for drying. By fixating the boards in special moulds, the b

UVA - 11437 - Triangle Fun (计算几何~)

UVA - 11437 Triangle Fun Time Limit: 1000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu Submit Status Description Problem A Triangle Fun Input: Standard Input Output: Standard Output In the picture below you can see a triangle ABC. Point D, E

UVA - 11796 - Dog Distance (计算几何~)

不得不感叹,计算几何真是太美丽了!! AC代码: #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> #include <cmath> using namespace std; struct Point { double x, y; Point(double x = 0, double y = 0) : x(x) , y(y) { } }; t

UVA - 11646 - Athletics Track (计算几何~)

题目地址:点这里 思路:计算几何入门题,首先,两个圆弧是同一个圆的,所以这个圆是矩形的外接圆,那么矩形中心就是圆心,由长宽算出角度和半径(这时用单位长度表示),再算出一个单位长度的实际长度,从而得出长和宽 AC代码: #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> #include <cmath> using namespace std;

UVA 10522 - Height to Area(计算几何)

这题就海伦公式带进去就可以了.. 要注意的是,这题的样例,是输入n次错误的输入才停止..,输入的可能是负数. 代码: #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; const double eps = 1e-8; int t; double Ha, Hb, Hc; int dcmp(double x) { if (

UVa 1643 Angle and Squares (计算几何)

题意:有n个正方形和一个角(均在第一象限中),使这些正方形与这个角构成封闭的阴影区域,求阴影区域面积的最大值. 析:很容易知道只有所有的正方形的对角形在一条直线时,是最大的,然后根据数学关系,就容易得到答案. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #incl

UVA 12300 - Smallest Regular Polygon(计算几何)

思路:找对点最优,奇数情况下,半径要另外算 大概这么一个图,偶数就是距离的一半,奇数的话,做一个正2N边形,那么半径就可以利用三角函数算出来了 然后有了外切圆半径,就能算面积了,为sin(2pi / n) * r * r * n / 2 代码: #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; const double