【模拟】BAPC2014 G Growling Gears (Codeforces GYM 100526)

时间:2023-03-09 05:41:03
【模拟】BAPC2014 G Growling Gears (Codeforces GYM 100526)

题目链接:

  http://codeforces.com/gym/100526

  http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11670&courseid=0

题目大意:

  N条开口朝下的抛物线T = -aR2 + bR + c,求哪条抛物线最高的点最高。

题目思路:

  【模拟】

  直接取x=b/2a带入抛物线计算最高点记录答案。

 //
//by coolxxx
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<map>
#include<memory.h>
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//#include<stdbool.h>
#include<math.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(a) ((a)>0?(a):(-(a)))
#define lowbit(a) (a&(-a))
#define sqr(a) ((a)*(a))
#define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
#define mem(a,b) memset(a,b,sizeof(a))
#define eps (1e-8)
#define J 10
#define mod 1000000007
#define MAX 0x7f7f7f7f
#define PI 3.14159265358979323
#define N 104
using namespace std;
typedef long long LL;
int cas,cass;
int n,m,lll,ans;
int num,a,b,c;
double anss;
int main()
{
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
// freopen("2.txt","w",stdout);
#endif
int i,j,k;
double x,y;
for(scanf("%d",&cas);cas;cas--)
// for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
// while(~scanf("%s",s+1))
// while(~scanf("%d",&n))
{
scanf("%d",&n);
anss=-*-*-;num=;
for(i=;i<=n;i++)
{
scanf("%d%d%d",&a,&b,&c);
x=b;
x=x/2.0/a;
y=-a*x*x+b*x+c;
if(anss<y)
{
anss=y;
num=i;
}
}
printf("%d\n",num);
}
return ;
}
/*
// //
*/