-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path12015.java
50 lines (37 loc) · 975 Bytes
/
12015.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* UVa 12015: Google is Feeling Lucky
*
* Problem Statement: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3166
*/
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
int max = Integer.MIN_VALUE;
ArrayList<String> winners = new ArrayList<String>();
String url = "";
int relevance;
for (int i = 0; i < t; i++) {
for (int j = 0; j < 10; j++) {
url = scan.next();
relevance = scan.nextInt();
if (relevance > max) {
winners.clear();
max = relevance;
}
if (relevance == max) {
winners.add(url);
}
}
System.out.println("Case #" + (i + 1) + ":");
for (String s : winners) {
System.out.println(s);
}
winners = new ArrayList<String>();
max = Integer.MIN_VALUE;
}
scan.close();
}
}