UVALive
来源:互联网 发布:百度指数如何导出知乎 编辑:程序博客网 时间:2024/06/16 09:34
#include<cstdio>#include<cstdlib>#include<cstring>#include<iostream>#include<cmath>#include<string>#include <bits/stdc++.h>using namespace std;typedef long long LL;const int N =1e5+10;const int inf = 0x3f3f3f3f;struct node{ double a, b, c;}p[N];int n;double get(double x){ double ans=0; ans=p[0].a*x*x+p[0].b*x+p[0].c; for(int i=1;i<n;i++) ans=max(ans,p[i].a*x*x+p[i].b*x+p[i].c); return ans;}int main(){ int t; scanf("%d", &t); while(t--) { scanf("%d", &n); for(int i=0;i<n;i++) scanf("%lf %lf %lf", &p[i].a, &p[i].b, &p[i].c); double l=0, r=1000, ans; for(int i=0;i<100;i++) { double x1=l+(r-l)/3, x2=(r-(r-l)/3); double y1=get(x1), y2=get(x2); if(y1<y2) ans=y1,r=x2; else ans=y2,l=x1; } printf("%.4f\n",ans); } return 0;}
阅读全文
0 0
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- python 三元组找上下位相同的词
- 仙人掌缩环求最短路Demo
- 0-1背包问题
- 带有图片预览功能的上传表单
- MyBatis输出日志
- UVALive
- Android 仿美团选择城市、微信通讯录、饿了么点餐列表的导航悬停分组索引列表
- ros_network两台计算机通信
- iOS开发中集成阿里云视频上传SDK总结
- C语言入门第一章
- hdu6127 思维
- 使用java语言实现9*9乘法表
- .NET Core 2.0发布了
- 三分