前言:
和队友一发入魂,很强势。
比赛中题目长的,就和队友一起读,这样比较快,然后还不会梦游,把点一句一句地搞出来。
思路:
在头5次,每次有人踢球就可能会输。
后面谁没进,对方进了救输。
代码:
//#include <bits/stdc++.h> #include<iostream> #include<cstdio> #include<queue> #include<math.h> #include<string.h> #include<algorithm> using namespace std; typedef long long LL; typedef pair<int,int> PII; int a[35]; int b[35]; char s[5]; int main() { int T; int cas=1; scanf("%d",&T); while(T--) { memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); for(int i=1; i<=11; i++) for(int j=1; j<=3; j++) { scanf("%s",s); if(strcmp(s,"yes")==0) a[(j-1)*11+i]=1; } for(int i=1; i<=11; i++) for(int j=1; j<=3; j++) { scanf("%s",s); if(strcmp(s,"yes")==0) b[(j-1)*11+i]=1; } printf("Match %d: ",cas++); int home=0; int away=0; for(int i=1;i<=33;i++) { home+=a[i]; if(i<=5) { if(home>(5-i+away+1)) { printf("Winner: home "); printf("Score: %d:%d ",home,away); break; } if(away>(5-i+home)) { printf("Winner: away "); printf("Score: %d:%d ",home,away); break; } } away+=b[i]; if(i<=5) { if(away>(5-i+home)) { printf("Winner: away "); printf("Score: %d:%d ",home,away); break; } if(home>(5-i+away)) { printf("Winner: home "); printf("Score: %d:%d ",home,away); break; } } else { if(home>away) { printf("Winner: home "); printf("Score: %d:%d ",home,away); break; } if(away>home) { printf("Winner: away "); printf("Score: %d:%d ",home,away); break; } } } } return 0; }