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

G Growling Gears
The Best Acceleration Production Company specializes in multi-gear engines. The performance
of an engine in a certain gear, measured in the amount of torque produced, is not constant:
the amount of torque depends on the RPM of the engine. This relationship can be described
using a torque-RPM curve.
RPM
Torque
Gear 1
Gear 2
The torque-RPM curve of the gears given in the second sample input.
The second gear can produce the highest torque.
For the latest line of engines, the torque-RPM curve of all gears in the engine is a parabola
of the form T = −aR2 + bR + c, where R is the RPM of the engine, and T is the resulting
torque.
Given the parabolas describing all gears in an engine, determine the gear in which the
highest torque is produced. The first gear is gear 1, the second gear is gear 2, etc. There will
be only one gear that produces the highest torque: all test cases are such that the maximum
torque is at least 1 higher than the maximum torque in all the other gears.
Input
On the first line one positive number: the number of test cases, at most 100. After that per test
case:
• one line with a single integer n (1 ≤ n ≤ 10): the number of gears in the engine.
• n lines, each with three space-separated integers a, b and c (1 ≤ a, b, c ≤ 10 000): the
parameters of the parabola T = −aR2 +bR+c describing the torque-RPM curve of each
engine.
Output
Per test case:
• one line with a single integer: the gear in which the maximum torque is generated.14 Problem G: Growling Gears
Sample in- and output
Input Output
3
1
1 4 2
2
3 126 1400
2 152 208
2
3 127 1400
2 154 208
1
2
2

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
#include <malloc.h>
#define Max(a,b) (a>b?a:b)
#define Min(a,b) (a<b?a:b)
#define MAX 999999999
#define LL long long
#define M 6666666
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int a,b,c,n,i,s[];
scanf("%d",&n);
for(i=;i<=n;i++)
{
scanf("%d%d%d",&a,&b,&c);
s[i]=(*(-*a)*c-b*b)/(*((-)*a));
}
int max=,g;
for(i=;i<=n;i++)
{
//printf("s=%d\n",s[i]);
if(s[i]>max)
{
g=i;
max=s[i];
}
}
printf("%d\n",g); }
return ;
}

Growling Gears的更多相关文章

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

    题目链接: http://codeforces.com/gym/100526 http://acm.hunnu.edu.cn/online/?action=problem&type=show& ...

  2. 计蒜客 28317.Growling Gears-一元二次方程的顶点公式 (Benelux Algorithm Programming Contest 2014 Final ACM-ICPC Asia Training League 暑假第一阶段第二场 G)

    G. Growling Gears 传送门 此题为签到题,直接中学的数学知识点,一元二次方程的顶点公式(-b/2*a,(4*a*c-b*b)/4*a):直接就可以得到结果. 代码: #include& ...

  3. ACM 第十七天

    暑期热身赛 BAPC 2014 The 2014 Benelux Algorithm Programming Contest 题目网址:https://odzkskevi.qnssl.com/3655 ...

  4. Benelux Algorithm Programming Contest 2014 Final(第二场)

    B:Button Bashing You recently acquired a new microwave, and noticed that it provides a large number ...

  5. error LNK2019: 无法解析的外部符号 ___glutInitWithExit@12,该符号在函数 _glutInit_ATEXIT_HACK@8 中被引用 1>GEARS.obj : er

    转: http://blog.csdn.net/bill_ming/article/details/8150111 opengl的高级菜鸟问题 看了一本书<OpenGL三维图形系统开发与应用技术 ...

  6. xtu read problem training 3 B - Gears

    Gears Time Limit: 2000ms Memory Limit: 65536KB This problem will be judged on ZJU. Original ID: 3789 ...

  7. 2015-2016 ACM-ICPC Pacific Northwest Regional Contest (Div. 2)V - Gears

    Problem V | limit 4 secondsGearsA set of gears is installed on the plane. You are given the center c ...

  8. 【分享】GEARS of DRAGOON 1+2【日文硬盘版】[带全CG存档&amp;攻略+SSG改动+打开存档补丁]

    冒险者们哟.寻找龙秘玉吧--! ninetail的最新作,是使用丰富多彩的技能·道具探索迷宫的3D迷宫RPG! 存在着骑士和神官的架空世界常见的职业为首的13种职业.超过数百种的道具的登场! 和伙伴一 ...

  9. 2014 Super Training #8 A Gears --并查集

    题意: 有N个齿轮,三种操作1.操作L x y:把齿轮x,y链接,若x,y已经属于某个齿轮组中,则这两组也会合并.2.操作Q x y:询问x,y旋转方向是否相同(等价于齿轮x,y的相对距离的奇偶性). ...

随机推荐

  1. java异常处理机制 (转载)

    java异常处理机制 本文来自:曹胜欢博客专栏.转载请注明出处:http://blog.csdn.net/csh624366188 异常处理是程序设计中一个非常重要的方面,也是程序设计的一大难点,从C ...

  2. Django同步创建models table失败

    django1.8通过manage.py syncdb 执行同步创建models中创建的表格失败 由于syncdb命令在1.9版本中会被remove, 需要改用makemigrations命令进行代替 ...

  3. 如何在Exe和BPL插件中实现公共变量共享及窗口溶入技术Demo源码

    如何在Exe和BPL插件中实现公共变量共享及窗口溶入技术Demo源码 1.Delphi编译方式介绍: 当我们在开发一个常规应用程序时,Delphi可以让我们用两种方式使用VCL,一种是把VCL中的申明 ...

  4. Django基本操作命令

    1.新建一个django项目 django-admin.py startproject project-name 2.新建一个app python manage.py startapp app-nam ...

  5. cx_Oracle ORA-24315: 非法的属性类型的解决办法

    网上查找原因说: 出现该错误的原因是因为版本不兼容. 检查了一下python版本和oracle 的版本,我的oracle client是10g的,python的版本是2.7, 但我安装的cx_orac ...

  6. django 的请求处理部分----WSGIHandler 源码分析 django1.5.5

    从这里拉开django框架的帷幕..撕开,哈哈 主要涉及的类:django.core.handlers.base.BaseHandler,django.core.handlers.wsgi.WSGIH ...

  7. 基于BOOST 实现并发服务器框架

    一:设计思路 本服务器框架使用 UDP 传输协议,程序柱线程等待客户端数据,并将数组存取队列缓冲区.另外可开启多个工作线程,工作线程可以依据具体项目实现不同的功能 ,例如可以将队列缓冲区中的数据逐个取 ...

  8. qt 5 数据库操作(mysql)

    其实大家都知道,QT5以上的都自带了数据库驱动,所以呢,基本上可以直接使用,于是如果想知道怎么连接数据库,请参考这位大神写的.http://qtdebug.com/DB-AccessMySQL.htm ...

  9. 【单片机通信协议】CAN总线基础知识

    CAN总线基础知识(一) 1.1 CAN总线是什么? CAN(Controller Area Network)是ISO国际标准化的串行通信协议.广泛应用于汽车.船舶等.具有已经被大家认可的高性能和可靠 ...

  10. 一般处理程序(ashx)和页面处理程序(aspx)的区别

    客官请看图   图中的Httphandler就是处理程序.   两者的共同点 如果把aspx处理程序和ashx处理程序放到上图中,他们是处在相同的位置的, 他们都实现了IHttphandler接口.实 ...