Training Contest 4 J - Joyless Game

Playing games is the best way to improve flexibility, critical thinking and strategy.

To become the best Pokenom player, Bash is playing some games with his Pokenom Chikapu.

Bash writes down a string S containing only lowercase English letters. No 2 consecutive characters in S are equal.

Bash and Chikapu alternatively take turns to play.

In each turn, a player must delete one character in S. There are 2 conditions:

The first and last characters can not be deleted.

After the character is deleted, in the new string, no 2 consecutive characters are equal.

The player who cannot delete a character loses.

Chikapu plays first.

After playing 109+7 games, Chikapu won 0 games and lost all 109+7 times. Chikapu thinks that Bash is cheating, by selecting a string S such that Bash always wins.

Given some string S, can you help determine who would win the game, if they both play optimally?

Input
The first line of input contains the integer T — the number of test cases (1≤T≤20).

The next T lines each contain exactly one string S (3≤|S|≤105).

Output
For each test case, print on one line the name of the winner, if they both play optimally. Please note that this problem uses case-sensitive checker.

题目来源 https://cn.vjudge.net/contest/317268#problem/J
在这个题无话可说,唉!!!

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<set>
using namespace std;
int main()
{
	string s;
	int n;
	cin>>n;
	while(n--)
	{
		cin>>s;
		int len=s.size();
		if(s[0]==s[len-1]){
			if(len%2==0)
				cout<<"Chikapu"<<endl;
			else
				cout<<"Bash"<<endl;				
		}
		else{
			if(len%2==0)
				cout<<"Bash"<<endl;
			else
				cout<<"Chikapu"<<endl;				
		}
	}
	return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值