时间限制:1 秒内存限制:32 兆特殊判题:否提交:24102解决:6126

题目描述:

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.

样例输入:

20 2 15 13 10 18

样例输出:

14.0

来源:

2011年浙江大学计算机及软件工程研究生机试真题

翻译题目:<忽略丑丑的字和翻译

代码如下:

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
using namespace std; int main()
{
int p=0,t=0,g1=0,g2=0,g3=0,g4=0;
int a,b,max;
float g;
while(scanf("%d %d %d %d %d %d",&p,&t,&g1,&g2,&g3,&g4)!=EOF){
if(abs(g1-g2) <= t){
g=(float)(g1+g2)/2;
}
else if(abs(g1-g3)<=t || abs(g2-g3)<=t)
{
a=abs(g1-g3);
b=abs(g2-g3);
if(a<t && b<t)
{
max=g1;
if(g2>max){
max=g2;
}
if(g3>max){
max=g3;
}
g=(float)max;
}
else if(a<b){
g=(float)(g1+g3)/2;
}
else{
g=(float)(g2+g3)/2;
}
}
else{
g=(float)g4;
}
printf("%.1f\n",g);
}
# return 0;
}`

结果:

  • 输出文件名: D:\DevC++\程序\two.exe
  • 输出大小: 362.3271484375 KiB
  • 编译时间: 0.45s

注意点:输入是有多组数据的。

九度OJ:1002-Grading的更多相关文章

  1. 九度oj 1002 Grading 2011年浙江大学计算机及软件工程研究生机试真题

    #include<iostream> #include<queue> #include<cstdio> #include<cstring> #inclu ...

  2. 九度OJ 1002:Grading

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:18410 解决:4753 题目描述: Grading hundreds of thousands of Graduate Entrance ...

  3. 九度oj题目1002:Grading

    //不是说C语言就是C++的子集么,为毛printf在九度OJ上不能通过编译,abs还不支持参数为整型的abs()重载 //C++比较正确的做法是#include<cmath.h>,cou ...

  4. hdu 1284 关于钱币兑换的一系列问题 九度oj 题目1408:吃豆机器人

    钱币兑换问题 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Sub ...

  5. 【九度OJ】题目1176:树查找 解题报告

    [九度OJ]题目1176:树查找 解题报告 标签(空格分隔): 九度OJ http://ac.jobdu.com/problem.php?pid=1176 题目描述: 有一棵树,输出某一深度的所有节点 ...

  6. 【九度OJ】题目1445:How Many Tables 解题报告

    [九度OJ]题目1445:How Many Tables 解题报告 标签(空格分隔): 九度OJ 原题地址:http://ac.jobdu.com/problem.php?pid=1445 题目描述: ...

  7. 【九度OJ】题目1109:连通图 解题报告

    [九度OJ]题目1109:连通图 解题报告 标签(空格分隔): 九度OJ 原题地址:http://ac.jobdu.com/problem.php?pid=1109 题目描述: 给定一个无向图和其中的 ...

  8. 九度oj 题目1087:约数的个数

    题目链接:http://ac.jobdu.com/problem.php?pid=1087 题目描述: 输入n个整数,依次输出每个数的约数的个数 输入: 输入的第一行为N,即数组的个数(N<=1 ...

  9. 九度OJ 1502 最大值最小化(JAVA)

    题目1502:最大值最小化(二分答案) 九度OJ Java import java.util.Scanner; public class Main { public static int max(in ...

  10. 九度OJ,题目1089:数字反转

    题目描述: 12翻一下是21,34翻一下是43,12+34是46,46翻一下是64,现在又任意两个正整数,问他们两个数反转的和是否等于两个数的和的反转. 输入: 第一行一个正整数表示测试数据的个数n. ...

随机推荐

  1. 如何用jQuery实现div随鼠标移动而移动(详解)?----2017-05-12

    重点是弄清楚如何获取鼠标现位置与移动后位置,div现在位置与移动后位置: 用jQuery实现div随鼠标移动而移动,不是鼠标自身的位置!!而是div相对于之前位置的移动 代码如下:(注意看绿色部分的解 ...

  2. 使用Browserify来实现CommonJS的浏览器加载

    前面的话 Nodejs的模块是基于CommonJS规范实现的,可不可以应用在浏览器环境中呢? var math = require('math'); math.add(2, 3); 第二行math.a ...

  3. myeclipse10.7安装git插件

    如果想把github上的一些开源项目导入到myeclipse中,一种方法是从github网站上将开源项目下载下来,另一种是使用myeclipse的egit插件直接从github网站上down下来,下面 ...

  4. Linux与堆栈概念

    在学习C/C++编程的时候,老师都会反复灌输一些概念.比如程序内变量在堆栈上的分配,栈是由高地址到低地址,堆是由低地址到高地址等等,然后画出这样一幅经典概念图: 图片来自:http://blog.cs ...

  5. OGNL表达式与EL表达式

    一.OGNL表达式 a)什么是OGNL? OGNL是Object-Graph Navigation Language的缩写,它是一种功能强大的表达式语言, 通过它简单一致的表达式语法.主要功能:    ...

  6. .net数据统计系统设计(中小型)

    近一年多没在博客园写东西了,从换公司后就一直努力学习公司的框架和业务.而今接手一个电商数据统计项目,在博客园搜索统计项目解决方案却一无所获,最终自己设计并在开发的过程中持续更新,希望可以和大家一起交流 ...

  7. 关于struts2 Could not find action or result错误

    今天来配置这个S2SH框架的的时候,刚把环境搭建好,启动时并没有报错,但是当我写了一个action,我也准备通过这个action来访问页面,但是这里我访问的时候却给我报Could not find a ...

  8. 一个gif远程crash你的微信!

    测试了一下iPhone6,iPhone7不同版本的 iOS上,收到某个天线宝宝的gif,最新版本的微信都会挂. demo视频:演示视频 通过 crash log可以看到微信最新的6.5.8版本在打开 ...

  9. Oracle CDC简介及异步在线日志CDC部署示例

    摘要 最近由于工作需要,花时间研究了一下Oracle CDC功能和LogMiner工具,希望能找到一种稳定.高效的技术来实现Oracle增量数据抽取功能.以下是个人的部分学习总结和部署实践. 1. O ...

  10. R实现地理位置与经纬度相互转换

    本实例要实现目标通过输入城市名或者地名,然后找出其经度纬度值,以及通过可视化展现其线路流向以及周边地图展示 address_list数据: 山西省太原市小店区亲贤北街77号 贵州省贵阳市云岩区书香门第 ...