0
My attempt:
#include <stdio.h>
#include <string.h>
int main() {
char rajesh[15], sheldon[15];
char pedra[] = "pedra", papel[] = "papel", tesoura[] = "tesoura",
lagarto[] = "lagarto", spock[] = "spock";
int c, i, comp;
printf("Digite a quantidade de casos de teste: \n");
scanf("%d", &c);
for(i = 0; i < c; i++) {
printf("Digite uma frase: \n");
scanf(" %s %s", rajesh, sheldon);
comp = strcmp(rajesh, sheldon);
if(comp == 0) {
printf("empate\n");
}
if(comp != 0) {
if((strcmp(rajesh, tesoura) == 0) && ((strcmp(sheldon, papel) == 0) ||
(strcmp(sheldon, lagarto) == 0))){
printf("radesh\n");
} else if((strcmp(sheldon, tesoura) == 0) && ((strcmp(rajesh, papel) == 0) ||
(strcmp(sheldon, lagarto) == 0))){
printf("sheldon\n");
}
if((strcmp(rajesh, papel) == 0) && ((strcmp(sheldon, pedra) == 0) ||
(strcmp(sheldon, spock) == 0))){
printf("radesh\n");
} else if((strcmp(sheldon, papel) == 0) && ((strcmp(rajesh, pedra) == 0) ||
(strcmp(rajesh, spock) == 0))){
printf("sheldon\n");
}
if((strcmp(rajesh, pedra) == 0) && ((strcmp(sheldon, lagarto) == 0) ||
(strcmp(sheldon, tesoura) == 0))){
printf("radesh\n");
} else if((strcmp(sheldon, pedra) == 0) && ((strcmp(rajesh, lagarto) == 0) ||
(strcmp(rajesh, tesoura) == 0))){
printf("sheldon\n");
}
if((strcmp(rajesh, lagarto) == 0) && ((strcmp(sheldon, spock) == 0) ||
(strcmp(sheldon, papel) == 0))){
printf("radesh\n");
} else if((strcmp(sheldon, lagarto) == 0) && ((strcmp(rajesh, spock) == 0) ||
(strcmp(rajesh, papel) == 0))){
printf("sheldon\n");
}
if((strcmp(rajesh, spock) == 0) && ((strcmp(sheldon, tesoura) == 0) ||
(strcmp(sheldon, pedra) == 0))){
printf("radesh\n");
} else if((strcmp(sheldon, spock) == 0) && ((strcmp(rajesh, tesoura) == 0) ||
(strcmp(rajesh, pedra) == 0))){
printf("sheldon\n");
}
}
}
return 0;
}
Link to the statement: https://www.urionlinejudge.com.br/judge/pt/problems/view/1873
Puts the type of error it returns. If you’re going to wait for someone to log in or create an account just to test your code, figure out the answer and then try to help you, I think the answer will take
– Evilmaax
It returns this error: Wrong Answer (40%).
– André Moreira