15145641

  这是一个水模拟,但是因为图片看不清,手打比较烧脑,我们错了好多次才过

#include<stdio.h>
#include<iostream>
#include<string.h>
#include<queue>
#include<algorithm>
using namespace std;
///0 Pock 1 Dcissors 2 Paper
int Judge(char *a,char *b)
{
    if(!strcmp(a,"cs"))
    {
        if(!strcmp(b,"Kamen")) return 0;
        if(!strcmp(b,"Nuzky")) return 1;
        if(!strcmp(b,"Papir")) return 2;
    }
    if(!strcmp(a,"en"))
    {
        if(!strcmp(b,"Rock")) return 0;
        if(!strcmp(b,"Scissors")) return 1;
        if(!strcmp(b,"Paper")) return 2;
    }
    if(!strcmp(a,"fr"))
    {
        if(!strcmp(b,"Pierre")) return 0;
        if(!strcmp(b,"Ciseaux")) return 1;
        if(!strcmp(b,"Feuille")) return 2;
    }
    if(!strcmp(a,"de"))
    {
        if(!strcmp(b,"Stein")) return 0;
        if(!strcmp(b,"Schere")) return 1;
        if(!strcmp(b,"Papier")) return 2;
    }
    if(!strcmp(a,"hu"))
    {
        if(!strcmp(b,"Ko") || !strcmp(b,"Koe")) return 0;
        if(!strcmp(b,"Ollo") || !strcmp(b,"Olloo")) return 1;
        if(!strcmp(b,"Papir")) return 2;
    }
    if(!strcmp(a,"it"))
    {
        if(!strcmp(b,"Sasso") || !strcmp(b,"Roccia")) return 0;
        if(!strcmp(b,"Forbice")) return 1;
        if(!strcmp(b,"Carta") || !strcmp(b,"Rete")) return 2;
    }
    if(!strcmp(a,"jp"))
    {
        if(!strcmp(b,"Guu")) return 0;
        if(!strcmp(b,"Choki")) return 1;
        if(!strcmp(b,"Paa")) return 2;
    }
    if(!strcmp(a,"pl"))
    {
        if(!strcmp(b,"Kamien")) return 0;
        if(!strcmp(b,"Nozyce")) return 1;
        if(!strcmp(b,"Papier")) return 2;
    }
    if(!strcmp(a,"es"))
    {
        if(!strcmp(b,"Piedra")) return 0;
        if(!strcmp(b,"Tijera")) return 1;
        if(!strcmp(b,"Papel")) return 2;
    }
}
int main()
{
    char cou1[200],cou2[200],p1[200],p2[200];
    bool flag = true;
    int ca = 0;
    while(~scanf("%s%s%s%s",cou1,p1,cou2,p2))
    {
        char op1[200],op2[200];
        int tot1 = 0,tot2 = 0;
        while(~scanf("%s",op1))
        {
            if(op1[0] == '-' || op1[0] == '.')
            {
                printf("Game #%d:\n",++ca);
                if(tot1 == 1)
                printf("%s: %d point\n",p1,tot1);
                else printf("%s: %d points\n",p1,tot1);
                if(tot2 == 1)
                printf("%s: %d point\n",p2,tot2);
                else printf("%s: %d points\n",p2,tot2);
                if(tot1 > tot2) printf("WINNER: %s\n",p1);
                else if(tot1 < tot2) printf("WINNER: %s\n",p2);
                else puts("TIED GAME");
                puts("");
                if(op1[0] == '.')flag = false;
                break;
            }
            scanf("%s",op2);
            int re1 = Judge(cou1,op1);
            int re2 = Judge(cou2,op2);
           /// cout<<"re1 = "<<re1<<endl;
           /// cout<<"re2 = "<<re2<<endl;
            if(re1 == re2) continue;
            if(re1 == 0 && re2 == 1) tot1++;
            else if(re1 == 1 && re2 == 2) tot1++;
            else if(re1 == 2 && re2 == 0) tot1++;
            else tot2++;
        }
        if(!flag) break;
    }
    return 0;
}

 

posted on 2016-05-02 15:22  icode-xiaohu  阅读(334)  评论(0编辑  收藏  举报