您的位置:首页 > 其它

codeforces:A. The Great Game

2014-04-04 20:07 423 查看
打开题目链接

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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: