思路:在 0--90 之内二分角 1 ,得到结果的余角即为答案。
代码如下:
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
#define pi 3.1415926
#define eps 1e-6
int main()
{
#ifdef OFFLINE
freopen("t.txt", "r", stdin);
#endif
double h, d, x, n1, n2;
while (~scanf("%lf%lf%lf%lf%lf", &d, &h, &x, &n1, &n2))
{
if (!h&&!d&&!x&&!n1&&!n2) break;
double mid, l = 0, r = 90, cta1, cta2;//二分cta1(角1)
while (l + eps <= r)
{
mid = (l + r) / 2;
cta1 = mid / 180 * pi;
cta2 = asin(sin(cta1)*n2 / n1);
if (d*tan(cta1) + h*tan(cta2) <= x)
l = mid;
else
r = mid;
}
printf("%.2lf\n", 90 - r);
}
return 0;
}