A. The Great Game
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion.
Input
The input contains two strings of equal length (between 2 and 20 characters, inclusive). Each line describes the actions of one team.
Output
Output "TEAM 1 WINS" if the first team won, "TEAM 2 WINS" if the second team won, and "TIE" if there was a tie.
Sample test(s)
input
[]()[]8< 8<[]()8<
output
TEAM 2 WINS
input
8<8<() []8<[]
output
TIE
对于此题表示自己看的时候没有看懂是什么意思,看了一下别人的题解,是石头、剪刀、布。
AC code:
/*
To this question,i am speechless.
looking other solutions,i don't known the sample test.
*/
#include <string.h>
#include <iostream>
using namespace std;
int main(){
char str1[20],str2[20];
while(cin>>str1>>str2)
{
int num1=0,num2=0;
int l1 = strlen(str1);
int l2 = strlen(str2);
for(int i=0;i<l1;i+=2){
if((str1[i]=='8' && str2[i]=='[')|| (str1[i]=='[' &&str2[i]=='(') || (str1[i]=='('&&str2[i]=='8'))
num1++;
else if((str2[i]=='8' && str1[i]=='[')|| (str2[i]=='[' &&str1[i]=='(') || (str2[i]=='('&&str1[i]=='8'))
num2++;
}
if(num1>num2)
cout<<"TEAM 1 WINS"<<endl;
else if(num2>num1)
cout<<"TEAM 2 WINS"<<endl;
else
cout<<"TIE"<<endl;
}
return 0;
}