codeforces:A. The Great Game

本文介绍了一个特殊的游戏对决问题,通过解析两个队伍的动作序列来决定胜负。每个动作由字符表示,如'8'、'['、'('分别代表石头、剪刀、布。文章提供了C++代码实现,用于判断两组序列的胜负情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >



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;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值