TOPIC
Porque recebo Presentation error ?
Guilherme asked 3 years ago
import java.util.Objects;
import java.util.Scanner;
/**
* Created by Guilherme on 29/04/2017.
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int i = scanner.nextInt(); //pedra, papel, tesoura, lagarto e Spock
for (int j = 0; j < i ; j++) {
String a = scanner.next();
String b = scanner.next();
if(game(a,b) == 1){
System.out.printf("Caso #%d: Bazinga!",j+1);
System.out.printf("\n");
}
else if (a.equals(b)){
System.out.printf("Caso #%d: De novo! ",j+1);
System.out.printf("\n");
}
else{
System.out.printf("Caso #%d: Raj trapaceou!",j+1);
System.out.printf("\n");
}
}
}
private static int game (String a, String b){
if (a.equals("tesoura")&& b.equals("papel")){
return 1;
}
else if(a.equals("papel") && b.equals("pedra")){
return 1;
}
else if(a.equals("pedra") && b.equals("lagarto")){
return 1;
}
else if(a.equals("lagarto") && b.equals("Spock")){
return 1;
}
else if(a.equals("Spock") && b.equals("tesoura")){
return 1;
}
else if(a.equals("tesoura") && b.equals("lagarto")){
return 1;
}
else if(a.equals("lagarto") && b.equals("papel")){
return 1;
}
else if(a.equals("papel") && b.equals("Spock")){
return 1;
}
else if(a.equals("Spock") && b.equals("pedra")){
return 1;
}
else if(a.equals("pedra") && b.equals("tesoura")){
return 1;
}
else{
return 0;
}
}
}