#include<iostream> #include<cstdio> #include<cstdlib> #include<string> #include<cstring> #include<cmath> #include<ctime> #include<algorithm> #include<utility> #include<stack> #include<queue> #include<vector> #include<set> #include<map> #include<bitset> #define PI acos(-1.0) #define INF 0x3f3f3f3f #define LL long long #define Pair pair<int,int> const double EPS = 1E-12; const int MOD = 1E9+7; const int N = 1000000+5; const int dx[] = {-1,1,0,0,-1,-1,1,1}; const int dy[] = {0,0,-1,1,-1,1,-1,1}; using namespace std; int n; double a[N],b[N],c[N]; double cal(double x){ double maxx=-INF; for(int i=1;i<=n;i++) maxx=max(maxx,a[i]*x*x+b[i]*x+c[i]); return maxx; } int main() { int t; scanf("%d",&t); while(t--){ scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%lf%lf%lf",&a[i],&b[i],&c[i]); double left=0,right=1000; while(right-left>=EPS){ double lmid=left+(right-left)/3.0; double rmid=right-(right-left)/3.0; if(cal(lmid)<=cal(rmid)) right=rmid; else left=lmid; } printf("%.4lf\n",cal(left)); } return 0; }
0.0分
1 人评分
大神老白 (C语言代码)浏览:768 |
【回文数(二)】 (C语言代码)浏览:940 |
钟神赛车 (C++代码)浏览:905 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:674 |
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:566 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:287 |
最小公倍数 (C语言代码)浏览:894 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:577 |
输出正反三角形 (C语言代码)浏览:859 |
兰顿蚂蚁 (C++代码)浏览:1160 |