UVA 12301 - An Angular Puzzle(计算几何)

这题就设AB是1,然后正弦余弦定理去搞搞搞就可以了

代码:

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

const double PI = acos(-1.0);

int a, b, c, d, e;

double get(double x) {
    return x / 180.0 * PI;
}

int main() {
    while (~scanf("%d%d%d%d%d", &a, &b, &c, &d, &e) && a || b || c || d || e) {
        if (a + b + c + d + e != 180) {
            printf("Impossible\n");
            continue;
        }
        double ACB = a, CAE = b, EAB = c, CBD = d, DBA = e;
        double AB = 1.0;
        double AOB = 180 - EAB - DBA;
        double CBA = CBD + DBA;
        double CAB = EAB + CAE;
        double AEB = 180 - EAB - CBA;
        double ADB = 180 - DBA - CAB;
        double BD = AB / sin(get(ADB)) * sin(get(CAB));
        double AE = AB / sin(get(AEB)) * sin(get(CBA));
        double AO = AB / sin(get(AOB)) * sin(get(DBA));
        double BO = AB / sin(get(AOB)) * sin(get(EAB));
        double EO = AE - AO;
        double DO = BD - BO;
        double DE = sqrt(EO * EO + DO * DO - DO * EO * 2 * cos(get(AOB)));
        double x = asin(DO * sin(get(AOB)) / DE) * 180 / PI;
        printf("%.2f\n", x);
    }
    return 0;
}
时间: 2024-08-28 01:47:44

UVA 12301 - An Angular Puzzle(计算几何)的相关文章

UVA - 12301 - An Angular Puzzle (计算几何~平面三角)

题目地址:点这里 思路:可以先确定A,B的坐标,然后再通过确定向量来硬算出角度..好像可以推公式做,没推出来╮(╯_╰)╭ AC代码: #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> #include <cmath> using namespace std; const double PI = 4 * atan(1.0); struct P

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 - 12301-An Angular Puzzle

给出如图三角形里的五个角度,求出x 我的做法: 直接写出表达式解 我的代码: #include<iostream> #include<map> #include<string> #include<cstring> #include<cstdio> #include<cstdlib> #include<cmath> #include<queue> #include<vector> #include&l

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 227 / UVALive 5166 Puzzle 谜题 (结构体)

Puzzle Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %llu Description   A children's puzzle that was popular 30 years ago consisted of a 5x5 frame which contained 24 small squares of equal size. A unique letter of the alphabet