题目1002:Grading

Posted AlvinZH

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了题目1002:Grading相关的知识,希望对你有一定的参考价值。

题目链接:http://ac.jobdu.com/problem.php?pid=1002

详解连接:https://github.com/Pacsiy/JobDu

参考代码:

//
// Created by AlvinZH on 2017/4/24.
// Copyright (c) AlvinZH. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
    double P,T,G1,G2,G3,GJ,ans;
    while(~scanf("%lf %lf %lf %lf %lf %lf",&P,&T,&G1,&G2,&G3,&GJ))
    {
        if(fabs(G1-G2)<=T) ans=(G1+G2)/2;
        else if(fabs(G3-G1)<=T&&fabs(G3-G2)>T) ans=(G3+G1)/2;
        else if(fabs(G3-G2)<=T&&fabs(G3-G1)>T) ans=(G3+G2)/2;
        else if(fabs(G3-G1)<=T&&fabs(G3-G2)<=T) ans=max(G1,max(G2,G3));
        else ans=GJ;

        printf("%.1lf\n",ans);
    }
    return 0;
}

 

以上是关于题目1002:Grading的主要内容,如果未能解决你的问题,请参考以下文章

题目1002:Grading

1002.Grading

九度OJ刷题——1002:Grading

UVA 111 History Grading

2019南京ICPC(重现赛) F - Paper Grading

2019 ICPC Asia Nanjing Regional F. Paper Grading