这题就设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;
}