zoukankan      html  css  js  c++  java
  • 【模拟】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带入抛物线计算最高点记录答案。

     1 //
     2 //by coolxxx
     3 //#include<bits/stdc++.h>
     4 #include<iostream>
     5 #include<algorithm>
     6 #include<string>
     7 #include<iomanip>
     8 #include<map>
     9 #include<memory.h>
    10 #include<time.h>
    11 #include<stdio.h>
    12 #include<stdlib.h>
    13 #include<string.h>
    14 //#include<stdbool.h>
    15 #include<math.h>
    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 10
    25 #define mod 1000000007
    26 #define MAX 0x7f7f7f7f
    27 #define PI 3.14159265358979323
    28 #define N 104
    29 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_JUDGE
    38 //    freopen("1.txt","r",stdin);
    39 //    freopen("2.txt","w",stdout);
    40     #endif
    41     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<y)
    57             {
    58                 anss=y;
    59                 num=i;
    60             }
    61         }
    62         printf("%d
    ",num);
    63     }
    64     return 0;
    65 }
    66 /*
    67 //
    68 
    69 //
    70 */
    View Code
  • 相关阅读:
    CodeForces 734F Anton and School
    CodeForces 733F Drivers Dissatisfaction
    CodeForces 733C Epidemic in Monstropolis
    ZOJ 3498 Javabeans
    ZOJ 3497 Mistwald
    ZOJ 3495 Lego Bricks
    CodeForces 732F Tourist Reform
    CodeForces 732E Sockets
    CodeForces 731E Funny Game
    CodeForces 731D 80-th Level Archeology
  • 原文地址:https://www.cnblogs.com/Coolxxx/p/5805152.html
Copyright © 2011-2022 走看看