【模拟】zoj3359

这个题。。。。trick挺多。。。

1.中途可能一队踢完另一对就不用踢了,

2.五球以内的判断

3.最后可能平局的说。。。。

#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
using namespace std;
int t,team1,team2;

struct rec
{
       char s[5][5];
}player[3][21];

void clear()
{
     memset(player,0,sizeof(player));
     team1=0;
     team2=0;
}

void Input()
{
     for (int i=1;i<=11;i++)
     {
         scanf("%s ",player[1][i].s[1]);
         scanf("%s ",player[1][i].s[2]);
         scanf("%s ",player[1][i].s[3]);
     }
     for (int i=1;i<=11;i++)
     {
         scanf("%s ",player[2][i].s[1]);
         scanf("%s ",player[2][i].s[2]);
         scanf("%s ",player[2][i].s[3]);
     }
}
void work()
{
     for (int i=1;i<=3;i++)
         for (int j=1;j<=11;j++)
         {
             if (player[1][j].s[i][0]=='y') team1++;
             if ((i-1)*11+j<=5)
             {
                if (team1>team2+5-j+1) return;
                if (team2>team1+5-j) return;
             }
             if (player[2][j].s[i][0]=='y') team2++;
             if ((i-1)*11+j<=5)
             {
                if (team1>team2+5-j) return;
                if (team2>team1+5-j) return;
             }
             if ((i-1)*11+j>5) 
             {
                if (team1>team2) return;
                if (team2>team1) return;
             }
         }
}
void output(int x)
{
     printf("Match %d:\n",x);
     if (team1>team2) printf("Winner: home\n");
     else printf("Winner: away\n");
     printf("Score: %d:%d\n",team1,team2);
}
int main()
{
    freopen("test.in","r",stdin);
    freopen("test.out","w",stdout);
    scanf("%d ",&t);
    for (int i=1;i<=t;i++)
    {
        clear();
        Input();
        work();
        output(i);
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值