Grading

2020-04-20 14:25:17 浏览数 (1)

题目描述 Grading hundreds of thousands of Graduate Entrance Exams is a hard work. It is even harder to design a process to make the results as fair as possible. One way is to assign each exam problem to 3 independent experts. If they do not agree to each other, a judge is invited to make the final decision. Now you are asked to write a program to help this process. For each problem, there is a full-mark P and a tolerance T(

代码语言:javascript复制
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int fullmark;
int T;
int G1,G2,G3,GJ;
double avg;

int main()
{
    while(cin>>fullmark>>T>>G1>>G2>>G3>>GJ){
        if(abs(G1-G2) <= T){
            avg = (G1   G2) * 1.0 / 2;
        }else if(abs(G1 - G3) <= T && abs(G2 - G3) <= T){
            avg = max(max(G1,G2),G3) * 1.0;
        }else if(abs(G1 - G3) <= T || abs(G2 - G3) <= T){
            if(abs(G1 - G3) <= T && abs(G2 - G3) > T){
                avg = (G1   G3) * 1.0 / 2;  
            }else if(abs(G2 - G3) <= T && abs(G1 - G3) > T){
                avg = (G2   G3) * 1.0 / 2;
            }
        }else{
            avg = GJ * 1.0; 
        }
        printf("%.1fn",avg);   
    }

    return 0;
 } 

0 人点赞