Skip to main content
adicionou 100 caracteres ao conteúdo
Fonte Link
Victor Stafusa
  • 64,9mil
  • 9
  • 120
  • 189
Formatação
Fonte Link
Victor Stafusa
  • 64,9mil
  • 9
  • 120
  • 189

#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"); }

#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;
}

}

return 0; }

#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; }

#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;
}
Fonte Link

Pedra-papel-tesoura-lagarto-Spock no Uri Online Judge ex. 1873, mas ele não aceita

#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; }