1.
/**
* Angewandte Mathematik, SS11
* Problem: 12015 Google is Feeling Lucky
* Link:
*
* @author Schramm, Felix
* @author Vogel, Johannes
* @version 1.0, 05/30/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.184
*/


import java.util.Scanner;

public class Main {


public static void main(String[] args) {
Scanner input = new Scanner(System.in);
StringBuffer output = new StringBuffer();
String[] sites = new String[10];
int[] relevance = new int[10];
int max = 0;
int cases = input.nextInt();
for(int i = 1; i<=cases;i++){
max = 0;
output.append(String.format("Case #%d:", i));
for(int j=0;j<10;j++){
sites[j]=input.next();
relevance[j]=input.nextInt();
max=max>relevance[j]?max:relevance[j];
}
for(int j=0;j<10;j++){
if(relevance[j]==max)
output.append("\n"+sites[j]);
}
if(i<9)
output.append("\n");
}
System.out.print(output);
}

}


2.

/**
* Angewandte Mathematik, SS11
* Problem: 12015
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=242&page=show_problem&problem=3166
*
* @author Fabian Trampusch
* @author Robert Schwarz
* @version 1.0, 05/31/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.100
*/

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;

public class Main {

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

int numTestCases = Integer.parseInt(br.readLine());

for(int i = 0; i < numTestCases; i++) {
ArrayList<String> highRankWebsites = new ArrayList<String>(10);

int biggestPageRank = 0;

for(int j = 0; j < 10; j++) {
String[] line = br.readLine().split(" ");
String currentPageName = line[0];
Integer currentPageRank = Integer.parseInt(line[1]);

if(currentPageRank > biggestPageRank) {
highRankWebsites.clear();
highRankWebsites.add(currentPageName);
biggestPageRank = currentPageRank;
}
else if(currentPageRank == biggestPageRank) {
highRankWebsites.add(currentPageName);
}
}

StringBuilder sb = new StringBuilder();
sb.append("Case #" + (i+1) + ":\n");
for(String website : highRankWebsites) {
sb.append(website + "\n");
}

System.out.print(sb.toString());
}
}
}

3.

/**
* Angewandte Mathematik, SS11
* Problem: 12015 - Google Is Feeling Lucky
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=242&page=show_problem&problem=3166
*
* @author Markus Schöllner
* @author Andreas Maier
* @version 1.0, 05/31/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.132
*/

import java.util.*;

public class Main {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int cases;
String url;
int relevance;
int lastRelevance = 0;
StringBuffer output = new StringBuffer("");

cases = input.nextInt();

for(int c = 1; c <= cases; c++){
output.append("Case #"+c+":");
lastRelevance = 0;
for(int i = 1; i <= 10;i++){
url = input.next();
relevance = input.nextInt();

if(relevance == lastRelevance) {
output.append("\n"+url);
}
else if(relevance > lastRelevance) {
output = new StringBuffer();
output.append("Case #"+c+":" +"\n"+url);
lastRelevance = relevance;
}
}
System.out.println(output);
}
}
}

4.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
* Angewandte Mathematik, SS11
* Problem: 12015 - Google is Feeling Lucky
* Link: http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=3166
*
* @author Benedikt Z¨nnchen
* @author Erik Wenzel
* @version 1.0, 05/06/2011
*
* Method : ad-hoc (recht einfach)
* Status : Accepted
* Runtime: 0.284
*
*/
public class Main
{
public static void main(String[] args) throws NumberFormatException, IOException
{
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));

int cases = Integer.parseInt(buffer.readLine());
for(int i = 1; i <= cases; i++)
{
StringBuffer sbuffer = new StringBuffer();
sbuffer.append("Case #"+i+":\n");
int max = 0;
for (int j = 0; j < 10; j++)
{
String[] line = buffer.readLine().split(" ");
int currentValue = Integer.parseInt(line[1]);
if(currentValue > max)
{
max = currentValue;
sbuffer = new StringBuffer();
sbuffer.append("Case #"+i+":\n");
sbuffer.append(line[0]+"\n");
}
else if(currentValue == max)
{
sbuffer.append(line[0]+"\n");
}
}
System.out.print(sbuffer.toString());
}
}
}

5.

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

/**
* FWP, Angewandte Mathematik, SS11
* Problem: 12015 - Google is Feeling Lucky
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9
*
* @author Sebastian Stumpf
* @author Benjamin Vogt
* @version 1.0, 2011-05-30 06:58:28
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.616
*/
public class Main
{
public static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int testCases = Integer.valueOf(reader.readLine());
StringTokenizer tokenizer;
StringBuilder sb = new StringBuilder();
for(int i = 0; i < testCases; ++i)
{
int maxPrior = 0;
for(int j = 0; j < 10; ++j)
{
tokenizer = new StringTokenizer(reader.readLine());
String adress = tokenizer.nextToken();
int prior = Integer.valueOf(tokenizer.nextToken());
if(prior == maxPrior)
sb.append(adress+"\n");
else if(prior > maxPrior)
{
sb.delete(0, sb.length());
sb.append(adress+"\n");
maxPrior = prior;
}
}
System.out.print("Case #"+(i+1)+":\n"+sb.toString());
sb.delete(0, sb.length());
}
}
}