-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathURI1129OpticalReader.java
More file actions
56 lines (50 loc) · 1.5 KB
/
URI1129OpticalReader.java
File metadata and controls
56 lines (50 loc) · 1.5 KB
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
51
52
53
54
55
56
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
/**
* See
* <a href="https://www.urionlinejudge.com.br/judge/en/problems/view/1129">Optical
* Reader
* </a>
*
* @author Brian Yeicol Restrepo Tangarife
*/
public class URI1129OpticalReader {
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter out = new PrintWriter(System.out);
static final char[] ANSWERS = {'A', 'B', 'C', 'D', 'E'};
public static void main(String[] args) throws IOException {
String l;
int N;
char answer;
String[] marks;
int graylevel;
while (!(l = read()).equals("0")) {
N = toInt(l);
while (N-- > 0) {
answer = '*';
marks = read().split("\\s");
for (int i = 0; i < 5; i++) {
graylevel = toInt(marks[i]);
if (graylevel <= 127) {
if (answer == '*') {
answer = ANSWERS[i];
} else {
answer = '*';
break;
}
}
}
out.println(answer);
}
}
out.close();
}
private static String read() throws IOException {
return in.readLine();
}
private static int toInt(String s) {
return Integer.parseInt(s);
}
}