利用两对相似三角形分别求出未知数x, y, z;
所求的高度为r + x,将其输出
accode:
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
int main()
{
std::ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
double r, a, b, h;
cin>>r>>a>>b>>h;
if(2 * r <= b)
cout<<"Drop"<<endl;
else
{
double x, y, z;
y = (b * 1.00 / 2.00 * h) * 1.00 / ((a - b) * 1.00 / 2);
z = sqrt((b * 1.00 / 2) * (b * 1.00 / 2) + y * y);
x = z * r * 1.00 / (b * 1.00 / 2) - r - y;
cout<<"Stuck"<<endl;
printf("%.7f\n", x+r);
}
return 0;
}