[April Fools Day Contest 2014A] [만우절 뇌동 퀴즈] The Great Game 가위바위보!

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.
Examples
input
[]()[]8<
8<[]()8<

output
TEAM 2 WINS

input
8<8<()
[]8<[]

output
TIE
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<string>
#include<ctype.h>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<bitset>
#include<algorithm>
#include<time.h>
using namespace std;
void fre() { freopen("c://test//input.in", "r", stdin); freopen("c://test//output.out", "w", stdout); }
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x,y) memcpy(x,y,sizeof(x))
#define MP(x,y) make_pair(x,y)
#define ls o<<1
#define rs o<<1|1
typedef long long LL;
typedef unsigned long long UL;
typedef unsigned int UI;
template <class T1, class T2>inline void gmax(T1 &a, T2 b) { if (b>a)a = b; }
template <class T1, class T2>inline void gmin(T1 &a, T2 b) { if (b<a)a = b; }
const int N = 100, M = 0, Z = 1e9 + 7, ms63 = 0x3f3f3f3f;
char a[N], b[N];
//8<   
//[]   
//()  
int check()
{
	int ret = 0;
	for (int i = 0; a[i]; i += 2)
	{
		if (a[i] == b[i]);
		else if (a[i] == '8')
		{
			if (b[i] == '[')++ret;
			if (b[i] == '(')--ret;
		}
		else if(a[i]=='[')
		{
			if (b[i] == '(')++ret;
			if (b[i] == '8')--ret;
		}
		else
		{
			if (b[i] == '8')++ret;
			if (b[i] == '[')--ret;
		}
	}
	return ret;
}
int main()
{
	while (~scanf("%s%s", a,b))
	{
		int ans=check();
		if (ans == 0)puts("TIE");
		else puts(ans > 0 ? "TEAM 1 WINS" : "TEAM 2 WINS");
	}
	return 0;
}
/*
【trick&&  】
         ——
this game to be the most intellectually challenging game in the world
        。    >_<

【  】
     ,    。

【  】
  

*/

좋은 웹페이지 즐겨찾기