时间限制: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. java环境安装之不能安装exe文件

    经过多年,打算再学下java 从官网下载java8安装包,但因为我的计算机的cd-room被卸载掉了,安装是报错说cab文件损坏之类的错误. 从stackOverflow中找到一篇眼前一亮的解决办法. ...

  2. loadrunner提高篇-场景设计实践

    集合点设置 一.为什么要进行集合点设置? 因为在测试过程中,并不能保证所有的Vuser都在同一时刻进行操作,这样就达不到并发测试的目的,故需要用到集合点技术,集合点的意思是如果在一个操作之前设置了一个 ...

  3. vim 和grep 正则表达式相似和区别

    正则表达式由两种基本字符类型组成:原义(正常)文本字符和元字符.元字符使正则表达式具有处理能力.所谓元字符就是指那些在正则表达式中具有特殊意义的专用字符,可以用来规定其前导字符(即位于元字符前面的字符 ...

  4. Ultimus BPM 房地产与建筑行业应用解决方案

    Ultimus BPM 房地产与建筑行业应用解决方案 行业应用需求 房地产与建筑行业客户业务特点是集团化管控,多区域.多项目.多业态管理,而行业业务往往项目周期长,涉及专业复杂,客户越来越重视管理和跟 ...

  5. Python爬虫02——贴吧图片爬虫V2.0

    Python小爬虫——贴吧图片爬虫V2.0 贴吧图片爬虫进阶:在上次的第一个小爬虫过后,用了几次发现每爬一个帖子,都要自己手动输入帖子链接,WTF这程序简直反人类!不行了不行了得改进改进. 思路: 贴 ...

  6. kotlin语言使用初体验(一)

    居说谷歌新认的干儿子kotlin极为受宠,隐隐有替代Java在 android平台老大位置的趋势.kotlin有谷歌撑腰,加上自己的底子也厚,再之与Java无缝兼容,将来在流行的编程语言中占有一席之地 ...

  7. javascript基础-对象

    原理 万物皆为对象.假设将'莫德'(我)看成对象.莫德的属性有名字,性别,年龄等. 莫德的行为有吃饭,走路,睡觉等.莫德与他人的往来即对象间的交互.对象对应世界的一个实体.类,即管理对象的分类.如果莫 ...

  8. C/C++遍历目录下的所有文件(Windows篇,超详细)

    注: 1. 本文讨论的是怎么用Windows API遍历目录下的所有文件.除Windows API,还有一种Windows/Linux通用的方式,使用<io.h>. 2. 本文部分翻译自M ...

  9. 对pathtracing的一些个人理解

    本人水平有限,若有错误也请指正~ 上面说到pathtracing(pt)的一些优点和缺点,优点即其实现很简单,这就是大概为什么当今市面上流行的很多渲染器如今都相继采用pathtracing算法为核心进 ...

  10. Java文件流应用:复制文件

    文件复制步骤 代码: package 文件流应用复制文件; import java.io.File; import java.io.FileInputStream; import java.io.Fi ...