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. C#基础(五)——类中私有构造函数作用

    如果类成员有private修饰符,就不允许在类范围以外访问这个类成员.对类构造函数应用private修饰符时,则禁止外部类创建该类的实例.尽管看上去有些不好理解(既然不能实例化,那么这个类还有什么用处 ...

  2. aspx与mvc页面验证码

    验证码类代码 using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Dr ...

  3. (转)HTTP协议(3)

    一.概念 协议是指计算机通信网络中两台计算机之间进行通信所必须共同遵守的规定或规则,超文本传输协议(HTTP)是一种通信协议,它允许将超文本标记语言(HTML)文档从Web服务器传送到客户端的浏览器. ...

  4. 解决MySQL查询不区分大小写

    需要设置collate(校对) . collate规则: *_bin: 表示的是binary case sensitive collation,也就是说是区分大小写的 *_cs: case sensi ...

  5. OFBiz之SVN下载地址

    trunk: $ svn co http://svn.apache.org/repos/asf/ofbiz/trunk ofbiz release13.07: $ svn co http://svn. ...

  6. Oracle 分析函数之聚集函数(MAX、MIN、AVG和SUM)

    MAX 查找组中表达式的最大值 MAX(COL ) OVER ( [ <partition_by_clause> ] < order_by_clause > )MIN 查找组中 ...

  7. 开发设计模式(八)抽象工厂模式(Abstract Factory Pattern)

    抽象工厂模式主要有以下角色: 抽象工厂角色:担任这个角色的是工厂方法模式的核心,它是与应用系统的商业逻辑无关的.通常使用接口或抽象类实现.    具体工厂角色:这个角色直接在客户端的调用下创建产品的实 ...

  8. mongodb 全文检索

    MongoDB 全文检索 全文检索对每一个词建立一个索引,指明该词在文章中出现的次数和位置,当用户查询时,检索程序就根据事先建立的索引进行查找,并将查找的结果反馈给用户的检索方式. 这个过程类似于通过 ...

  9. xss攻击入门

    xss表示Cross Site Scripting(跨站脚本攻击),它与SQL注入攻击类似,SQL注入攻击中以SQL语句作为用户输入,从而达到查询/修改/删除数据的目的,而在xss攻击中,通过插入恶意 ...

  10. float([x]): 将一个字符串或数转换为浮点数。如果无参数将返回0.0

    float([x]): 将一个字符串或数转换为浮点数.如果无参数将返回0.0 >>> float(12) 12.0 >>> float(-122) -122.0 & ...