2013
11-12

# Judging Olympia

For years, a group of Regional Contest Directors (RCDs) of the ACM International Collegiate Programming Contest (ICPC) have been unsatisfied with the way contest submissions get ranked. The group sees it is academically wrong to emphasize the importance of program correctness, disregarding the “quality” of the program itself. After all, programming as a profession promotes design, style, maintainability, etc. and not just correctness. The group’s suggestion is to have a panel of six judges. Each judge is assigned the task of grading the submissions based on a particular aspect: 1) Correctness; 2) Robustness; 3) Overall design; 4) Clarity; 5) Coding style; and finally 6) Maintainability. The final grade of a submission would be the average of the six grades it gets.

The old guards of the current ICPC judging style have always responded that it is not possible to impartially judge a program on anything but correctness. How can the ICPC be certain that judging is fair? In other words, how can the ICPC be sure that non of the judges is favoring certain teams and disadvantaging others? Any hint of accusation to the judging process and ICPC loses the prestigious status it worked on for years. (Alright! So they do have a point.) Still, this hasn’t stopped other domains from judging candidates based on subjective metrics. Take for example Gymnastics, or The Nobel Prizes, or even the ACM’s very own Doctoral Dissertation Award. These are all highly respected awards where the winner is selected by judges using subjective metrics. ICPC could use a new judging system based on what is used in gymnastics. Rather than having each judge grade a certain aspect of the program, each of the six judges would assign an overall grade (out of ten) based on all of the six metrics mentioned above. To enforce impartiality, the final grade of a submission would be calculated as the average of all the grades after deleting two grades: The highest and the lowest. Any judge that favors a certain team (and assigns them an undeserved high grade,) risks the possibility of that grade being dismissed. Similarly, any judge that attempts to disadvantage a team by assigning them a low grade faces a similar risk.

Write a program to print the final grade of a submission.

Your program will be tested on one or more test cases. Each test case is described on a single input line listing the grades of the judges. The end of the test cases is identified with a dummy test case with all the grades being zero.

For each test case, print the grade on a separate line (without unnecessary decimal points and/or zeros.)

8 8 8 4 4 4
8 8 6 4 4 3
0 0 0 0 0 0

6
5.5

//* @author 洪晓鹏<[email protected]/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */>
(1)
import java.util.Scanner;

public class Main {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
float[] input = new float[6];
while(true)
{
input[0] = in.nextFloat();
float max = input[0];
float min = input[0];
float sum = input[0];
for(int i = 1; i < 6; i++)
{
input[i] = in.nextFloat();
if(max < input[i])
max = input[i];
if(min > input[i])
min = input[i];
sum = sum + input[i];
}
if(sum == 0.0)
break;
else
{
sum -= min;
sum -= max;
}
float result = sum/4;
int res = (int)sum/4;
if(res*4 == sum)
System.out.println(res);
else
System.out.println(result);
}
}
}

(2)
import java.io.IOException;
import java.math.BigDecimal;
import java.util.StringTokenizer;
public class Main {
public static void main(String args[]) throws IOException{
StringTokenizer tokens=new StringTokenizer(a);
float[] nums=new float[6];
double prom;
while(!a.equals("0 0 0 0 0 0")){
nums[0]=Float.parseFloat(tokens.nextToken());
nums[1]=Float.parseFloat(tokens.nextToken());
nums[2]=Float.parseFloat(tokens.nextToken());
nums[3]=Float.parseFloat(tokens.nextToken());
nums[4]=Float.parseFloat(tokens.nextToken());
nums[5]=Float.parseFloat(tokens.nextToken());
java.util.Arrays.sort(nums);
prom=(nums[3]+nums[1]+nums[2]+nums[4])/4;
BigDecimal dec=new BigDecimal(prom);
System.out.println(dec);
tokens=new StringTokenizer(a);
}
}
}

1. 约瑟夫也用说这么长……很成熟的一个问题了，分治的方法解起来o(n)就可以了，有兴趣可以看看具体数学的第一章，关于约瑟夫问题推导出了一系列的结论，很漂亮

2. 思路二可以用一个长度为k的队列来实现，入队后判断下队尾元素的next指针是否为空，若为空，则出队指针即为所求。

3. L（X [0 .. M-1]，Y [0 .. N-1]）= 1 + L（X [0 .. M-2]，Y [0 .. N-1]）这个地方也也有笔误
应改为L（X [0 .. M-1]，Y [0 .. N-1]）= 1 + L（X [0 .. M-2]，Y [0 .. N-2]）

4. Often We don’t set up on weblogs, but I would like to condition that this established up really forced me individually to do this! considerably outstanding publish