1.

/**
* Angewandte Mathematik, SS11
* Problem: 10370 Above Average
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=15&page=show_problem&problem=1311
*
* @author Unverzart Michael
* @author Wurth Manuel
* @version 1.0, 26/3/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.256
*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
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;
int test_case=0;
int grade;
int sum=0;
double avg;
double real;
int over_avg=0;

test_case+=new Integer(inputLine = reader.readLine());
if(test_case >= 1 && test_case <= 1000)
{
for(int j=1 ; j <= test_case ; j++)
{
inputLine = reader.readLine();

StringTokenizer first_run = new StringTokenizer(inputLine);
StringTokenizer last_run = new StringTokenizer(inputLine);
int n = new Integer(first_run.nextToken());

last_run.nextToken();

for(int i=1;i<=n;i++)
{
int add = new Integer(first_run.nextToken());
if(add >= 0 && add <= 100)sum += add;
else throw new Exception();
}

avg=sum/n;
for(int i=1;i<=n;i++)
{
if(new Integer(last_run.nextToken())>avg) over_avg++;
}

real=(100f/n)*over_avg;
String ausgabe = String.format("%.3f", real)+"%";
System.out.println(ausgabe.replace(',','.'));
grade=sum=over_avg=0;
avg=real=0;
}
}
else throw new Exception();
}
}

2.

import java.text.DecimalFormat;
import java.util.Scanner;

/**
* Angewandte Mathematik, SS11
* Problem: 10370 Average Above
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=15&page=show_problem&problem=1311
*
* @author Benedikt Z¨nnchen
* @author Erik Wenzel
* @version 1.0, 03/24/2011
*
* Method : ad-hoc
* Status : Accepted
* Runtime: 0.460
*/

public class Main
{

public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int cases = sc.nextInt();
int studentCount = 0;
int degreeSum = 0;
int[] students;
float degreeGrade = 0;
int overAverageCount = 0;
float result;

for(int i=0; i<cases; i++)
{
studentCount = sc.nextInt();
students = new int[studentCount];
for(int j=0; j<studentCount; j++)
{
students[j]=sc.nextInt();
degreeSum += students[j];
}
degreeGrade = (float)degreeSum / (float)studentCount;

for(int j=0; j<studentCount; j++)
{
if(students[j]>degreeGrade)
{
overAverageCount++;
}
}
result = ((float)overAverageCount / (float)studentCount)*100000;
DecimalFormat df = new DecimalFormat("0.000");
String s = df.format((float) Math.round(result) / 1000);
System.out.println(s+"%");
overAverageCount = 0;
degreeSum = 0;
}
sc.close();
}

}

3.

/**
* Angewandte Mathematik, SS11
* Problem: 10370 - Above Average
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=15&page=show_problem&problem=1311
*
* @author Markus Schöllner
* @author Andreas Maier
* @version 1.0, 04/20/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.480
*/

import java.text.*;
import java.util.*;

public class Main {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

int cases = input.nextInt();
double students;
double[] points;
double result;
double avarage;
double counter;
double output;

DecimalFormat f = new DecimalFormat("#0.000");

for(int c=1;c<=cases;c++){
students = input.nextInt();
points = new double[Math.abs((int) students)];
result =0;
counter =0;
if(students != 0){
for(int s=0;s<students;s++){
points[s] = input.nextInt();
result = result + points[s];
}
avarage = result / students;
for(int s=0;s<students;s++){
if(avarage < points[s]){
counter++;
}
}
output = (counter/students)*100;
System.out.println(f.format(output).replace(",",".")+"%");
}
else System.out.print("-nan%"+"\n");
}
}
}

4.

package sem2.am.aboveaverage;

/**
* Angewandte Mathematik, SS11
* Problem: 10370 - Above Average
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=15&page=show_problem&problem=1311
*
* @author Florian Stein
* @author Franz Sommer
* @version 1.0, 05/01/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.504
*/

import java.text.DecimalFormat;
import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int tests = sc.nextInt();

for (int i = 0; i < tests; i++) {

// anzahl der studenten auslesen
int students = sc.nextInt();

// array um noten zwischen zu speichern
int[] grade = new int[students];

// noten der studenten aufnahmen
double average = 0.0;
for (int j = 0; j < students; j++) {
grade[j] = sc.nextInt();
average = average + grade[j];
}

// durchschnitt berechnen
average = average / students;

// ausrechnen wie viele ueberm durchschnitt sind
double aboveAverage = 0.0;
for (int j = 0; j < students; j++) {
if (grade[j] > average) {
aboveAverage++;
}
}

// studenten ueber durchschnitt berechnen
aboveAverage = (aboveAverage / students) * 100;

// 3 nachkommastellen formatierung
DecimalFormat df = new DecimalFormat("#0.000");

System.out.println(df.format(aboveAverage) + "%");
}
}

}

5.
/**
* Angewandte Mathematik, SS11
* Problem: 10340 All in all
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=23&page=show_problem&problem=2113
*
* @author Peter Weismann
* @author Pirmin Schneider
* @version 1.0, 05/03/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.288
*/
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String s;
String t;

while (input.hasNext()) {
s = input.next();
t = input.next();
if (search(s,t))
System.out.println("Yes");
else
System.out.println("No");
}
}

// Sucht, ob a ein Substring von b ist und gibt true || false aus
public static boolean search (String s, String t) {
boolean notFound = false;
int j = 0;
int aLength = s.length();
int bLength = t.length();

// Abbruchkriterium (Wenn der gesuchte String laenger als der ist, in dem gesucht wird)
if (s.length() > t.length())
return false;

for (int i = 0; i < aLength; i++) {
while (j < bLength) {
if (s.charAt(i) == t.charAt(j)) {
j++;
break;
}
else {
if (j == t.length() - 1) {
// Abbruchkriterium (ersetzt das break fuer die // aeussere Schleife)
i = aLength;
notFound = true;
break;
}
j++;
}
}
}

if (notFound)
return false;
else
return true;
}

}


-----------------------------------------------------------------------------------------------------

1.


/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, WS10/11
* Problem: 10370 Above Average
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=15&page=show_problem&problem=1311
*
* @author Fabian Liebl
* @version 1.0, 10/06/2010
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.268
*/

import java.io.*;

public class Main {

public static void main(String[] args) throws IOException {
BufferedReader inputReader = new BufferedReader(new InputStreamReader(System.in));

int testCases;
int peopleInClass;
double average;
double aboveAverage;

String[] line;

testCases = Integer.parseInt(inputReader.readLine());

for (int i = 0; i < testCases; i++) {
line = inputReader.readLine().split(" ");

peopleInClass = Integer.parseInt(line[0]);

average = 0.0;
for (int j = 0; j < peopleInClass; j++) {
average += Integer.parseInt(line[j+1]);
}

average /= peopleInClass;

aboveAverage = 0.0;
for (int j = 0; j < peopleInClass; j++) {
if (Integer.parseInt(line[j+1]) > average) {
aboveAverage ++;
}
}

aboveAverage /= peopleInClass;

System.out.printf("%.3f%%\n", aboveAverage*100);
}
}

}