-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10556.cpp
More file actions
88 lines (75 loc) · 2.04 KB
/
10556.cpp
File metadata and controls
88 lines (75 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/**
* ____
* ____ ___ ____ ________ __/ __/
* / __ `__ \/ __ `/ ___/ / / / /_
* / / / / / / /_/ / / / /_/ / __/
* /_/ /_/ /_/\__,_/_/ \__,_/_/
*
* @link : https://the-redback.com
*/
#include <bits/stdc++.h>
using namespace std;
#define mem(a, b) memset(a, b, sizeof(a))
#define pb push_back
#define pp pop_back
#define inf 10e9 // 10^9
#define meminf 100
#define eps 10e-5
#define NN 1000000
struct P {
double x, y;
P(double X, double Y) {
x = X;
y = Y;
}
};
vector<P> v;
P MV(P a, P b) { return P(b.x - a.x, b.y - a.y); }
double DP(P a, P b) { return a.x * b.x + a.y * b.y; }
double CP(P a, P b) { return a.x * b.y - a.y * b.x; }
double A(P a) { return sqrt(a.x * a.x + a.y * a.y); }
P ADD(P a, P b) { return P(a.x + b.x, a.y + b.y); }
P LV(P a, double l) { return P(a.x * l / A(a), a.y * l / A(a)); }
P pvt(0, 0);
bool comp(P a, P b) // False hoile sort korbe
{
long long c = CP(MV(pvt, a), MV(pvt, b));
if (c) return c > 0;
return A(MV(pvt, a)) < A(MV(pvt, b));
}
void checkPvt(void) {
pvt.x = inf;
pvt.y = inf;
for (int i = 0; i < v.size(); i++) {
if (pvt.x > v[i].x)
pvt = v[i];
else if (pvt.x == v[i].x && pvt.y > v[i].y)
pvt = v[i];
}
}
int main() {
ios_base::sync_with_stdio(false);
int t = 1, tc;
int i, j, k, l, m, n;
double x, y, z, u, w, xx, yy, zz, d, h;
double aa, bb, cc, dd;
// cin>>tc;
while (cin >> x >> y >> h) {
double low = 0, high = min(x, y);
double mid;
while (high - low > eps) {
mid = (low + high) / 2.0;
double theta1 = acos(mid / y);
double theta2 = acos(mid / x);
double m1 = h / (tan(theta1));
double m2 = h / (tan(theta2));
if (mid == (m1 + m2)) break;
if (mid > (m1 + m2))
low = mid;
else
high = mid;
}
printf("%.3lf\n", mid);
}
return 0;
}