国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

1002_Grading

2019-11-11 00:37:49
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
// 1002_Grading.cpp : 定義控制臺(tái)應(yīng)用程序的入口點(diǎn)。//題目1002:Grading//時(shí)間限制:1 秒內(nèi)存限制:32 兆特殊判題:否提交:21415解決:5522//題目描述:// 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//來(lái)源://2011年浙江大學(xué)計(jì)算機(jī)及軟件工程研究生機(jī)試真題#include "stdafx.h"#include "stdio.h"#include "math.h"int main(){ int p,t,g1,g2,g3,gj; while(scanf("%d %d %d %d %d %d",&p,&t,&g1,&g2,&g3,&gj)!=EOF) { if(abs(g1-g2)<=t) printf("%.1f/n",(float)(g1+g2)/2); else if(abs(g3-g1)<=t && abs(g3-g2)<=t) { int max = g1; if(g2>g1) max =g2; if(g3>g1&&g3>g2) max= g3; printf("%.1f/n",(float)max); } else if(abs(g3-g1)<=t) printf("%.1f/n",(float)(g3+g1)/2); else if (abs(g3-g2)<=t) printf("%.1f/n",(float)(g3+g2)/2); else if(abs(g3-g2)>t &&abs(g3-g1)>t) printf("%.1f/n",(float)gj); } //printf("%.1f",(float)(3+4)/2); return 0;}/*abs();*/
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 汝州市| 鄢陵县| 万山特区| 湄潭县| 彩票| 泊头市| 兰州市| 修水县| 宿州市| 巴林右旗| 乌苏市| 尼玛县| 山东省| 晋州市| 通州区| 临清市| 罗山县| 峨眉山市| 吉林省| 介休市| 凌源市| 额敏县| 湖南省| 南丰县| 泊头市| 阳信县| 云南省| 彭泽县| 德保县| 故城县| 水城县| 深水埗区| 苍梧县| 黄大仙区| 通榆县| 宝应县| 浮山县| 道孚县| 罗定市| 磐石市| 红原县|