本文共 1433 字,大约阅读时间需要 4 分钟。
题目链接:
题目大意:
N条开口朝下的抛物线T = -aR2 + bR + c,求哪条抛物线最高的点最高。
题目思路:
【模拟】
直接取x=b/2a带入抛物线计算最高点记录答案。
1 // 2 //by coolxxx 3 //#include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 //#include 15 #include 16 #define min(a,b) ((a)<(b)?(a):(b))17 #define max(a,b) ((a)>(b)?(a):(b))18 #define abs(a) ((a)>0?(a):(-(a)))19 #define lowbit(a) (a&(-a))20 #define sqr(a) ((a)*(a))21 #define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))22 #define mem(a,b) memset(a,b,sizeof(a))23 #define eps (1e-8)24 #define J 1025 #define mod 100000000726 #define MAX 0x7f7f7f7f27 #define PI 3.1415926535897932328 #define N 10429 using namespace std;30 typedef long long LL;31 int cas,cass;32 int n,m,lll,ans;33 int num,a,b,c;34 double anss;35 int main()36 {37 #ifndef ONLINE_JUDGE38 // freopen("1.txt","r",stdin);39 // freopen("2.txt","w",stdout);40 #endif41 int i,j,k;42 double x,y;43 for(scanf("%d",&cas);cas;cas--)44 // for(scanf("%d",&cas),cass=1;cass<=cas;cass++)45 // while(~scanf("%s",s+1))46 // while(~scanf("%d",&n))47 {48 scanf("%d",&n);49 anss=-10000*10000-10000*5000-10000;num=0;50 for(i=1;i<=n;i++)51 {52 scanf("%d%d%d",&a,&b,&c);53 x=b;54 x=x/2.0/a;55 y=-a*x*x+b*x+c;56 if(anss
转载于:https://www.cnblogs.com/Coolxxx/p/5805152.html