描述

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(<P) given. The grading rules are:     • A problem will first be assigned to 2 experts, to obtain G1 and G2. If the difference is within the tolerance, that is, if |G1 - G2| ≤ T, this problem's grade will be the average of G1 and G2.     • If the difference exceeds T, the 3rd expert will give G3.     • If G3 is within the tolerance with either G1 or G2, but NOT both, then this problem's grade will be the average of G3 and the closest grade.     • If G3 is within the tolerance with both G1 and G2, then this problem's grade will be the maximum of the three grades.     • If G3 is within the tolerance with neither G1 nor G2, a judge will give the final grade GJ.

输入描述:

Each input file may contain more than one test case.     Each case occupies a line containing six positive integers: P, T, G1, G2, G3, and GJ, as described in the problem. It is guaranteed that all the grades are valid, that is, in the interval [0, P].

输出描述:

For each test case you should output the final grade of the problem in a line. The answer must be accurate to 1 decimal place.

示例1

输入:

20 2 15 13 10 18

输出:

14.0

#include <iostream>
using namespace std;int main() {int P,T,G1,G2,G3,GJ;while(~scanf("%d %d %d %d %d %d",&P,&T,&G1,&G2,&G3,&GJ)){double answer;if(abs(G1 - G2) <= T){answer = (G1 + G2) / 2.0;} else if(abs(G3 - G1) <= T && abs(G3 - G2) <= T){answer = max(max(G1,G2),G3);} else if(abs(G3 - G1) <= T){answer = (G3 + G1) / 2.0;} else if(abs(G3 - G2) <= T){answer = (G3 + G2) / 2.0;} else{answer = GJ;}printf("%.1f",answer);  //输出形式保留一位小数}
}

【复试机试】Grading相关推荐

  1. 华科00年计算机考研复试机试

    [1]输入n, 求y1=1!+3!+...m!(m是小于等于n的最大奇数) y2=2!+4!+...p!(p是小于等于n的最大偶数) 参考代码: #include<stdio.h> int ...

  2. 华师大计算机在线作业,华东师范大学计算机考研复试机试习题

    华东师范大学计算机考研复试机试习题 华东师范大学计算机考研:计算机系.数据学院复试机试历年真题以及AC代码.历年学长总结得到.适用学院:计算机学院.数据学院.软件学院也可参考.sum/=10;prin ...

  3. 1004: 惠民工程 (2013年中南大学研究生复试机试 )

    1004: 惠民工程 时间限制: 1 Sec  内存限制: 128 MB 提交: 404  解决: 81 [提交] [状态] [讨论版] [命题人:外部导入] 题目描述 市政府"惠民工程&q ...

  4. 计算机保研面试基础知识,华科计算机保研复试机试题目

    华中科技大学复试机试题目 2008年 一. 1.狼过河问题(运用到回溯) 2.统计文件中单词数目 3.N阶楼梯上楼问题:一次可以走两阶或一阶,问有多少种上楼方式.(递归) 4.链表操作 二. 第一个是 ...

  5. 华科计算机保研复试题目,华科计算机保研复试机试题目2.doc

    华中科技大学复试机试题目 2008年 一. 1.狼过河问题(运用到回溯) 2.统计文件中单词数目 3.N阶楼梯上楼问题:一次可以走两阶或一阶,问有多少种上楼方式.(递归) 4.链表操作 二. 第一个是 ...

  6. 【超级完整】北京理工大学计算机复试机试历年真题答案2003年-2018年

    本人已经把该博客代码部分整理,在另一篇博客中: [超级完整-更正版]北京理工大学计算机专业复试机试历年真题答案2003年-2018年 目 录 1-2003两个空间坐标求球的体积 1 2-2003计算某 ...

  7. 上海交大计算机考研复试,上海交大计算机考研复试机试

    上海交大 计算机考研 SJTU-CS 复试机试 (2005-2010) 题目 我自己在准备考研时曾做了下06,07,08,09年的题目,并且在博客中提供了一个参考的题解,10年的题目以及11年保研的题 ...

  8. 211大学计算机复试不机试,复试机试之上海交通大学计算机研究生机试真题.doc...

    复试机试之上海交通大学计算机研究生机试真题 (你自己回去改格式啊,这个有多重繁杂字体,你自己改好看点~~还有知识05年到11年的)复试机试之2011年上海交通大学计算机研究生机试真题 (2012-02 ...

  9. 计算机复试机试题目与答案,二零一四年华中科技大学计算机研究生复试机试题目...

    2014年华中科技大学计算机研究生复试机试题目 2014年研究生复试终于结束了,因为自己寻找往年机试题目的经历很艰难,故我希望为之后的学弟,学妹们提供一些资料,以供参考. 今年机试题目总共有3道,编译 ...

  10. 清华计算机考研复试机试,请问清华考研计算机复试考什么

    满意答案 vwild 2015.06.01 采纳率:55%    等级:11 已帮助:5245人 清华大学计算机专业研究生复试有体检,专业课笔试,英语面试,上机考试,导师面试等几个部分.而复试的比例一 ...

最新文章

  1. 关于ftp的说法错误的是_斯坦福教授:成长型思维的养成,只需要换个说法,思维是可以训练的!...
  2. mongodb内存限制初探
  3. Java如何转换protobuf-net中的bcl.Decimal对象
  4. HTML转存问题测试
  5. 第三方登录 人人php,人人网第三方登录接口方案
  6. PWM信号作用示例——调节台灯亮度
  7. Pytest fixture之request传参
  8. JS 防止表单重复提交
  9. 1.6 logistic回归的keras实现
  10. zabbix源分支---zabbix-rpm
  11. L1-037 A除以B (10 分)—团体程序设计天梯赛
  12. 超全!JAVA基础知识点总结
  13. 简述三级管开关的导通条件
  14. opencapwap简要分析
  15. 古琴岭南派传承人:古琴是精品教育 传承无需操之过急
  16. 第一章:计算机组成与体系结构(软件设计师备考)
  17. iphone开发之仿微信用户引导界面的实现
  18. 性能优化系列(五)网络性能优化
  19. 直线上最多的点数java
  20. 苹果8a1660是什么版本_苹果A1660是什么型号?

热门文章

  1. miui12android11,基于安卓11正式版打造 MIUI 12稳定版内测 首批支持小米系列
  2. Window效率软件清单
  3. 米家、华为HiLink有安防设备,智汀也有安防设备啦
  4. python3学习笔记之七——爬虫之爬取qq表情金馆长
  5. BlueStacks模拟器:多平台上运行Android应用
  6. DS期末复习卷(九)
  7. IPI030N10N3G 英飞凌 100V OptiMOS
  8. performance_schema详解一
  9. iOS-Simulator设置模拟定位
  10. ZBrush 2021来了