uva 12301 - An Angular Puzzle(几何)

942 篇文章 2 订阅
99 篇文章 0 订阅

题目链接:uva 12301 - An Angular Puzzle


假设底边的值,计算出所有边的关系


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;
const double pi = 4 * atan(1);

double get(double x) {
	return x * pi / 180;
}

int main () {
	int a, b, c, d, e;
	while (scanf("%d%d%d%d%d", &a, &b, &c, &d, &e) == 5) {
		int s = a + b + c + d + e;
		if (s == 0)
			break;

		if (s == 180) {
			double BC = sin(get(b + c)) / sin(get(a));
			double BE = sin(get(c)) / sin(get(180 - c - d - e));
			double CE = BC - BE;

			double AC = sin(get(d + e)) / sin(get(a));
			double AD = sin(get(e)) / sin(get(180 - b - c - e));
			double CD = AC - AD;

			double DE = sqrt(CE * CE + CD * CD - 2 * CE * CD * cos(get(a)));
			double ans = asin( sin(get(b)) * AD / DE );
			printf("%.2lf\n", ans / pi * 180);
		} else
			printf("Impossible\n");
	}
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值