1. 

/**
* FWP: Ausgewaehlte Probleme aus dem ACM (SS10)
*
* Problem: 11777 - Automate The Grades
* Method: ad hoc
* Accepted: 0.196
* @author Evgeni Pavlidis
*
*/

import java.io.*;
import java.util.*;

class Main {

public static void main(String...args)
{
Scanner scanner = new Scanner(System.in);
double sum;
int a,b,c, tmp;
char output;
double EPSILON = 0.000001;

int testCases = scanner.nextInt();
for(int tc = 1; tc <= testCases; tc++)
{
sum = scanner.nextInt();// * 0.2;
sum += scanner.nextInt();// * 0.2;
sum += scanner.nextInt();// * 0.3;
sum += scanner.nextInt();// * 0.1;
a = scanner.nextInt();
b = scanner.nextInt();
c = scanner.nextInt();
tmp = a + b + c;
a = Math.min(Math.min(a,b), c);
tmp -= a;
sum += tmp/2;// * 0.2;
if(sum > 90 - EPSILON)
output = 'A';
else if ( sum > 80 - EPSILON)
output = 'B';
else if ( sum > 70 - EPSILON)
output = 'C';
else if ( sum > 60 - EPSILON)
output = 'D';
else
output = 'F';

System.out.println("Case " + tc + ": " + output);
}
}
}

2.

/**
* Angewandte Mathematik, SS11
* Problem: 11777 Automate the Grades
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=117&problem=2877
* @author Unverzart Michael
* @author Wurth Manuel
* @version 1.0, 8/5/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.112
*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String inputLine = null;
int cases = new Integer(reader.readLine());
int count=1;
for(int i=1;i<=cases;i++){
inputLine = reader.readLine();
StringTokenizer st = new StringTokenizer(inputLine);
float ergebnis = 0;
ergebnis+=new Integer(st.nextToken());
ergebnis+=new Integer(st.nextToken());
ergebnis+=new Integer(st.nextToken());
ergebnis+=new Integer(st.nextToken());
int[] tmp = new int[3];
tmp[0]= new Integer(st.nextToken());
tmp[1]= new Integer(st.nextToken());
tmp[2]= new Integer(st.nextToken());
Arrays.sort(tmp);
ergebnis+=(tmp[1]+tmp[2])/2f;

if(ergebnis>=90) System.out.println("Case "+count+": A");
if(ergebnis>=80 && ergebnis < 90) System.out.println("Case "+count+": B");
if(ergebnis>=70 && ergebnis < 80) System.out.println("Case "+count+": C");
if(ergebnis>=60 && ergebnis < 70) System.out.println("Case "+count+": D");
if(ergebnis<60) System.out.println("Case "+count+": F");
count++;
}
}
}