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. text与button上下不对齐解决方法

    火狐可以对齐,但是IE8不行,加上浮动就可以了 .search_right input[type=button] { float:right; }

  2. 修改VC++2010界面左上角图标

    (1)在Resource View中创建或者插入一个新的Icon资源,用于你想要的程序图标,假设ID号为IDI_ICON(这种图标要有16*16和32*32两种格式的,前者用于最小化和列表显示等,后者 ...

  3. python基础学习(二)--函数

    return返回值: python函数都有返回值,函数体内无return,默认返回值None, 函数参数: 1.普通参数 严格按照顺序,将实际参数赋值给形式参数,一一对应. 例: def send(x ...

  4. CentOS添加RPMforge软件源

    1.查看CentOS版本 cat /etc/redhat-release 2.查看系统位数 uname -i 3.下载rpm包 wget "rpm地址" CentOS 6: i68 ...

  5. java学习:用反射构造bean

    先贴一些反射的基本知识:-------------------------------------------------------------------- 一.什么是反射:反射的概念是由Smit ...

  6. WiFi与WLAN的区别

    很多人到了某一个地方首选要找的就是无线网络,有时候还会问周围的人:这里有WiFi吗?或者说:这里有WLAN吗?那WiFi和WLAN有什么区别呢? 简单来讲,WiFi是无线保真(wireless fid ...

  7. H5动画优化之路

    H5动画60fps之路 在移动端,和Native相比,H5一直都被人吐槽性能差,尤其是在动画方面. 谈到整个Web app的生命周期,一般分为四个部分: 加载 等待用户 响应用户 动画 一般情况下,首 ...

  8. vs2013运行c语言出现:无法查找或打开 PDB 文件。

    vs2013运行c语言出现:无法查找或打开 PDB 文件.    “ConsoleApplication1.exe”(Win32): 已加载“C:\Users\hp\Documents\Visual ...

  9. HTML5-canvas实例:刮刮乐游戏

    实现方法: (1)利用canvas画布,fillRect()描绘出一个矩形(不是透明),定位盖在某个标签如div上面(这个标签写着中奖的信息) (2)globalCompositeOperation ...

  10. [转载]C#实现POST提交方式

    网页自动登录和提交POST信息的核心就是分析网页的源代码(HTML),在C#中,可以用来提取网页HTML的组件比较多,常用的用WebBrowser.WebClient.HttpWebRequest这三 ...