zoukankan      html  css  js  c++  java
  • 666

    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    #include<iostream>
    using namespace std;
    char con[2][5];
    char name[2][20];
    
    char str0[30],str1[20];
    char str[50];
    char s1[3][20]={"Kamen","Nuzky","Papir"};
    char s2[3][20]={"Rock","Scissors","Paper"};
    char s3[3][20]={"Pierre","Ciseaux","Feuille"};
    char s4[3][20]={"Stein","Schere","Papier"};
    char s5[5][20]={"Ko","Ollo","Papir","Koe","Olloo"};
    char s6[5][20]={"Sasso","Forbice","Carta","Roccia","Rete"};
    char s7[3][20]={"Guu","Choki","Paa"};
    char s8[3][20]={"Kamien","Nozyce","Papier"};
    char s9[3][20]={"Piedra","Tijera","Papel"};
    
    
    
    
    
    int main()
    {
        int cas=1;
        while(scanf("%s %s",con[0],name[0])!=EOF)
        {
             scanf("%s %s",con[1],name[1]);
             int sum0=0,sum1=0;
             getchar();
            while(gets(str)){
    
                if(str[0]=='-'||str[0]=='.')
                    break;
                int tmp_len;
                int show0,show1;
                bool flag=true;
                int head_len=0;
                if(con[0][0]=='c'&&con[0][1]=='s'){
                    tmp_len=strlen(s1[0]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s1[0][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                     //   flag=false;
                        head_len=tmp_len;
                        show0=1;
                    }
    
                   flag=true;
                    tmp_len=strlen(s1[1]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s1[1][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                        head_len=tmp_len;
                        show0=2;
                    }
                    flag=true;
                    tmp_len=strlen(s1[2]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s1[2][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                      //  flag=false;
                        head_len=tmp_len;
                        show0=3;
                    }
    
    
                }
                else if(con[0][0]=='e'&&con[0][1]=='n'){
                     flag=true;  tmp_len=strlen(s2[0]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s2[0][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=1;
                    }
    
    
                 flag=true;   tmp_len=strlen(s2[1]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s2[1][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=2;
                    }
    
                flag=true;    tmp_len=strlen(s2[2]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s2[2][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=3;
                    }
                }
                else if(con[0][0]=='f'&&con[0][1]=='r'){
                  flag=true;    tmp_len=strlen(s3[0]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s3[0][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=1;
                    }
    
    
                  flag=true;  tmp_len=strlen(s3[1]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s3[1][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=2;
                    }
    
                flag=true;    tmp_len=strlen(s3[2]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s3[2][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=3;
                    }
                }
                else if(con[0][0]=='d'&&con[0][1]=='e'){
                  flag=true;   tmp_len=strlen(s4[0]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s4[0][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=1;
                    }
    
    
                  flag=true;  tmp_len=strlen(s4[1]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s4[1][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=2;
                    }
    
                  flag=true;  tmp_len=strlen(s4[2]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s4[2][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                        show0=3;flag=false;
                        head_len=tmp_len;
                    }
                }
                else if(con[0][0]=='h'&&con[0][1]=='u'){
                    flag=true;     tmp_len=strlen(s5[0]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s5[0][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=1;
                    }
    
    
                 flag=true;   tmp_len=strlen(s5[1]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s5[1][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=2;
                    }
    
                 flag=true;   tmp_len=strlen(s5[2]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s5[2][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=3;
                    }
    
    
                     flag=true;   tmp_len=strlen(s5[3]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s5[3][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=1;
                    }
    
    
    
                     flag=true;   tmp_len=strlen(s5[4]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s5[4][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=2;
                    }
    
    
    
    
                }
                else if(con[0][0]=='i'&&con[0][1]=='t'){
           flag=true;             tmp_len=strlen(s6[0]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s6[0][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=1;
                    }
    
    
              flag=true;      tmp_len=strlen(s6[1]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s6[1][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=2;
                    }
    
                flag=true;    tmp_len=strlen(s6[2]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s6[2][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=3;
                    }
    
    
                         flag=true;    tmp_len=strlen(s6[3]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s6[3][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=1;
                    }
    
    
                         flag=true;    tmp_len=strlen(s6[4]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s6[4][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=3;
                    }
                }
                else if(con[0][0]=='j'&&con[0][1]=='p'){
                   flag=true;   tmp_len=strlen(s7[0]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s7[0][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=1;
                    }
    
    
                  flag=true;  tmp_len=strlen(s7[1]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s7[1][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=2;
                    }
    
                  flag=true;  tmp_len=strlen(s7[2]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s7[2][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=3;
                    }
                }
                else if(con[0][0]=='p'&&con[0][1]=='l'){
                    flag=true;    tmp_len=strlen(s8[0]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s8[0][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=1;
                    }
    
    
                  flag=true;  tmp_len=strlen(s8[1]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s8[1][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=2;
                    }
    
                 flag=true;   tmp_len=strlen(s8[2]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s8[2][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=3;
                    }
                }
                else if(con[0][0]=='e'&&con[0][1]=='s'){
             flag=true;  tmp_len=strlen(s9[0]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s9[0][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=1;
                    }
    
    
                flag=true;    tmp_len=strlen(s9[1]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s9[1][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=2;
                    }
    
                 flag=true;   tmp_len=strlen(s9[2]);
                    for(int i=0;i<tmp_len;i++){
                        if(str[i]!=s9[2][i]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                        head_len=tmp_len;
                        show0=3;
                    }
                }
    
    
    
                head_len++;
    //printf("------------------------------%d
    ",head_len);
    
                if(con[1][0]=='c'&&con[1][1]=='s'){
                   flag=true;  tmp_len=strlen(s1[0]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s1[0][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                        flag=false;
                      //  head_len=tmp_len;
                        show1=1;
                    }
    
    
                  flag=true;  tmp_len=strlen(s1[1]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s1[1][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=2;
                    }
    
                 flag=true;   tmp_len=strlen(s1[2]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s1[2][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                     //   head_len=tmp_len;
                        show1=3;
                    }
                }
                else if(con[1][0]=='e'&&con[1][1]=='n'){
                    //    printf("22222222222222222222
    ");
    
                     flag=true;
                  tmp_len=strlen(s2[0]);
                   //    printf("%d   %d
    ",head_len,tmp_len+head_len);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s2[0][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                        flag=false;
                       // head_len=tmp_len;
                        show1=1;
                    }
    
    
                   flag=true; tmp_len=strlen(s2[1]);
                      //  printf("%d   %d
    ",head_len,tmp_len+head_len);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s2[1][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                     //   head_len=tmp_len;
                        show1=2;
                    }
    
                  flag=true;  tmp_len=strlen(s2[2]);
                    //   printf("%d   %d
    ",head_len,tmp_len+head_len);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s2[2][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=3;
                    }
                }
                else if(con[1][0]=='f'&&con[1][1]=='r'){
                flag=true;     tmp_len=strlen(s3[0]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s3[0][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                        flag=false;
                     //   head_len=tmp_len;
                        show1=1;
                    }
    
    
                  flag=true;  tmp_len=strlen(s3[1]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s3[1][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                   //     head_len=tmp_len;
                        show1=2;
                    }
    flag=true;
                    tmp_len=strlen(s3[2]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s3[2][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                     //   head_len=tmp_len;
                        show1=3;
                    }
                }
                else if(con[1][0]=='d'&&con[1][1]=='e'){
                   flag=true;  tmp_len=strlen(s4[0]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s4[0][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                        flag=false;
                       // head_len=tmp_len;
                        show1=1;
                    }
    
    
                   flag=true; tmp_len=strlen(s4[1]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s4[1][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=2;
                    }
    
                  flag=true;  tmp_len=strlen(s4[2]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s4[2][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                     //   head_len=tmp_len;
                        show1=3;
                    }
                }
                else if(con[1][0]=='h'&&con[1][1]=='u'){
                   flag=true;  tmp_len=strlen(s5[0]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s5[0][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                        flag=false;
                     //   head_len=tmp_len;
                        show1=1;
                    }
    
    
                 flag=true;   tmp_len=strlen(s5[1]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s5[1][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=2;
                    }
    
                  flag=true;  tmp_len=strlen(s5[2]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s5[2][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=3;
                    }
    
    
                      flag=true;  tmp_len=strlen(s5[3]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s5[3][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=1;
                    }
    
    
                      flag=true;  tmp_len=strlen(s5[4]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s5[4][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=2;
                    }
    
    
                }
                else if(con[1][0]=='i'&&con[1][1]=='t'){
              flag=true;       tmp_len=strlen(s6[0]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s6[0][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                        flag=false;
                       // head_len=tmp_len;
                        show1=1;
                    }
    
    
                 flag=true;   tmp_len=strlen(s6[1]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s6[1][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                     //   head_len=tmp_len;
                        show1=2;
                    }
    
                 flag=true;   tmp_len=strlen(s6[2]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s6[2][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=3;
                    }
    
    
                         flag=true;   tmp_len=strlen(s6[3]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s6[3][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=1;
                    }
    
                         flag=true;   tmp_len=strlen(s6[4]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s6[4][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=3;
                    }
                }
                else if(con[1][0]=='j'&&con[1][1]=='p'){
                   flag=true;  tmp_len=strlen(s7[0]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s7[0][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                        flag=false;
                      //  head_len=tmp_len;
                        show1=1;
                    }
    
    flag=true;
                    tmp_len=strlen(s7[1]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s7[1][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=2;
                    }
    
                flag=true;   tmp_len=strlen(s7[2]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s7[2][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=3;
                    }
                }
                else if(con[1][0]=='p'&&con[1][1]=='l'){
               flag=true;      tmp_len=strlen(s8[0]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s8[0][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                        flag=false;
                      //  head_len=tmp_len;
                        show1=1;
                    }
    
    
                 flag=true;   tmp_len=strlen(s8[1]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s8[1][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=2;
                    }
    
                  flag=true;  tmp_len=strlen(s8[2]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s8[2][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=3;
                    }
                }
                else if(con[1][0]=='e'&&con[1][1]=='s'){
                   flag=true;  tmp_len=strlen(s9[0]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s9[0][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){
                        flag=false;
                     //   head_len=tmp_len;
                        show1=1;
                    }
    
    
                  flag=true;  tmp_len=strlen(s9[1]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s9[1][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                       // head_len=tmp_len;
                        show1=2;
                    }
    
                  flag=true;  tmp_len=strlen(s9[2]);
                    for(int i=head_len;i<tmp_len+head_len;i++){
                        if(str[i]!=s9[2][i-head_len]){
                            flag=false;
                            break;
                        }
                    }
                    if(flag){flag=false;
                      //  head_len=tmp_len;
                        show1=3;
                    }
                }
    
            //    printf("-------------%d %d
    ",show0,show1);
    
    
                if((show0==1&&show1==2)||(show0==2&&show1==3)||(show0==3&&show1==1)){
                    sum0++;
                  //  printf("nihap
    ");
                    }
    
                if((show1==1&&show0==2)||(show1==2&&show0==3)||(show1==3&&show0==1)){
                    sum1++;
               //     printf("nihao
    ");
                    }
    
            }
    
            printf("Game #%d:
    ",cas++);
            if(sum0==1)
                printf("%s: %d point
    ",name[0],sum0);
            else
                printf("%s: %d points
    ",name[0],sum0);
            if(sum1==1)
                printf("%s: %d point
    ",name[1],sum1);
            else
                printf("%s: %d points
    ",name[1],sum1);
    
            if(sum0==sum1)
                printf("TIED GAME
    ");
            else if(sum0>sum1)
                printf("WINNER: %s
    ",name[0]);
            else if(sum0<sum1)
                printf("WINNER: %s
    ",name[1]);
            printf("
    ");
        }
        return 0;
    }
  • 相关阅读:
    Intern Day16
    粉红
    开始还房贷!
    Sonnet-十四行诗
    CSS兼容大全
    TCL电视直播软件
    《Linux权威指南》阅读笔记(2)
    《Linux权威指南》阅读笔记(1)
    Linux crontab定时执行任务 命令格式与详细例子
    linux下find查找命令用法
  • 原文地址:https://www.cnblogs.com/13224ACMer/p/5452207.html
Copyright © 2011-2022 走看看