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
| #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
const int inf = 0x3f3f3f3f;
const int ninf = 0xc0c0c0c0;
const double dinf = numeric_limits<double>::max();
const double dninf = numeric_limits<double>::min();
const double eps = 1e-9;
#define AC ios_base::sync_with_stdio(0), cin.tie(0);
#define rep(i, j, k) for (int i = j; i < k; i++)
#define repb(i, j, k) for (int i = j; i >= k; i--)
#define all(v) (v).begin(), (v).end()
#define endl '\n'
#define F first
#define S second
#define err(a) cerr << #a << ": " << a << endl
typedef struct Func {
double a, b, c;
} Func;
double f(Func func, double x)
{
return func.a * x * x + func.b * x + func.c;
}
double triSearch(vector<Func>& vf, double lowest_x, double highest_x)
{
double low = lowest_x, l, r, high = highest_x;
int n = vf.size();
while (high - low > eps)
{
l = low + (high - low) / 3, r = l + (high - low) / 3;
double lv = dinf, rv = dinf;
rep(i, 0, n)
{
lv = min(lv, f(vf[i], l));
rv = min(rv, f(vf[i], r));
}
if (lv < rv) low = l;
else high = r;
}
return low;
}
int main() {
AC;
int n; cin >> n;
vector<Func> v(n);
rep(i, 0, n)
{
cin >> v[i].a >> v[i].b >> v[i].c;
}
cout << fixed << setprecision(6) << triSearch(v, 0.0, 60.0 * 24.0 * 94.0) << endl;
return 0;
}
|