TOPIC

50%WA any help?

Carlos Lopez asked 3 years ago

I'm recieving 50%WA with my code but I run all the tests and still searching for a mistake

#include <iostream>
#include <string.h>
using namespace std;

int main() {
    char A[7]="pedra",B[7]="papel",C[8]="tesoura",D[8]="lagarto",E[7]="Spock";
    char S[7],R[7];
    int a,r,s;
    cin>>a;
    for(int i=1;i<=a;i++){
        cin>>S>>R;
        cout<<"Caso #"<<i<<": ";
        if(strncmp(A,S,6)==0){s=1;}
        else if(strncmp(B,S,6)==0){s=2;}
        else if(strncmp(C,S,8)==0){s=3;}
        else if(strncmp(D,S,8)==0){s=4;}
        else{s=5;}
        if(strncmp(A,R,6)==0){r=1;}
        else if(strncmp(B,R,6)==0){r=2;}
        else if(strncmp(C,R,8)==0){r=3;}
        else if(strncmp(D,R,8)==0){r=4;}
        else{r=5;}
        if(strncmp(S,R,8)==0){cout<<"De novo!"<<'\n';}
        else if((s==1&&(r==4||r==3))||(s==2&&(r==1||r==5))||(s==3&&(r==2||r==4))||(s==4&&(r==5||r==2))||(s==5&&(r==3||r==1))){cout<<"Bazinga!"<<'\n';}
        else{cout<<"Raj trapaceou!"<<'\n';}
    }
    return 0;
}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.