- Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathAutomatedJudgeScript.java
More file actions
Latest commit
48 lines (43 loc) · 1.48 KB
/
Copy pathAutomatedJudgeScript.java
File metadata and controls
48 lines (43 loc) · 1.48 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
importjava.io.BufferedReader;
importjava.io.IOException;
importjava.io.InputStreamReader;
importjava.util.Arrays;
publicclassAutomatedJudgeScript {
privatestaticfinalBufferedReaderreader = newBufferedReader(
newInputStreamReader(System.in));
privatestaticStringread(intn) throwsIOException {
StringBuilderinput = newStringBuilder();
intnewlines = 0;
while (newlines < n) {
intc = reader.read();
if (c == '\n') {
newlines++;
}
input.append((char) c);
}
returninput.toString();
}
publicstaticvoidmain(String[] args) throwsIOException {
inti = 0;
while (true) {
intn = Integer.parseInt(reader.readLine().trim());
if (n == 0) {
break;
}
Stringsrc = read(n);
Stringdst = read(Integer.parseInt(reader.readLine().trim()));
System.out.print("Run #" + (++i) + ": ");
if (src.equals(dst)) {
System.out.println("Accepted");
} else {
if (Arrays.equals(
src.chars().filter(Character::isDigit).toArray(),
dst.chars().filter(Character::isDigit).toArray())) {
System.out.println("Presentation Error");
} else {
System.out.println("Wrong Answer");
}
}
}
}
}