(UVA) 10188 - Automated Judge Script - Solução
import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
Main processando = new Main();
processando.takeInput();
System.exit(0);
}
void takeInput() throws NumberFormatException, IOException {
String line = "";
StringTokenizer tokenizer = null;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int run = 0;
while ((line = br.readLine()) != null) {
run++;
tokenizer = new StringTokenizer(line);
int N = Integer.parseInt(tokenizer.nextToken());
if (N == 0) {
return;
}
String[] vetor = new String[2];
vetor[0] = "";
vetor[1] = "";
for (int i = 0 ; i < N; i++) {
vetor[0] += br.readLine();
}
// lê resposta do time
line = br.readLine();
tokenizer = new StringTokenizer(line);
int M = Integer.parseInt(tokenizer.nextToken());
for (int i = 0 ; i < M; i++) {
vetor[1] += br.readLine();
}
String[] numbers = new String[2];
numbers[0] = "";
numbers[1] = "";
for (int k = 0; k < 2; k++) {
for (int i = 0; i < vetor[k].length(); i++) {
if (vetor[k].charAt(i) >= '0' && vetor[k].charAt(i) <='9') {
numbers[k] += vetor[k].charAt(i);
}
}
}
if (vetor[0].compareTo(vetor[1]) == 0 && N == M) {
System.out.println("Run #" + run + ": Accepted");
} else if (numbers[0].compareTo(numbers[1]) == 0) {
System.out.println("Run #" + run + ": Presentation Error");
} else {
System.out.println("Run #" + run + ": Wrong Answer");
}
}
return;
}
}
import java.util.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
Main processando = new Main();
processando.takeInput();
System.exit(0);
}
void takeInput() throws NumberFormatException, IOException {
String line = "";
StringTokenizer tokenizer = null;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int run = 0;
while ((line = br.readLine()) != null) {
run++;
tokenizer = new StringTokenizer(line);
int N = Integer.parseInt(tokenizer.nextToken());
if (N == 0) {
return;
}
String[] vetor = new String[2];
vetor[0] = "";
vetor[1] = "";
for (int i = 0 ; i < N; i++) {
vetor[0] += br.readLine();
}
// lê resposta do time
line = br.readLine();
tokenizer = new StringTokenizer(line);
int M = Integer.parseInt(tokenizer.nextToken());
for (int i = 0 ; i < M; i++) {
vetor[1] += br.readLine();
}
String[] numbers = new String[2];
numbers[0] = "";
numbers[1] = "";
for (int k = 0; k < 2; k++) {
for (int i = 0; i < vetor[k].length(); i++) {
if (vetor[k].charAt(i) >= '0' && vetor[k].charAt(i) <='9') {
numbers[k] += vetor[k].charAt(i);
}
}
}
if (vetor[0].compareTo(vetor[1]) == 0 && N == M) {
System.out.println("Run #" + run + ": Accepted");
} else if (numbers[0].compareTo(numbers[1]) == 0) {
System.out.println("Run #" + run + ": Presentation Error");
} else {
System.out.println("Run #" + run + ": Wrong Answer");
}
}
return;
}
}
Comments
Post a Comment