F - Game HDU - 3389

Bob and Alice are playing a new game. There are n boxes which have been numbered from 1 to n. Each box is either empty or contains several cards. Bob and Alice move the cards in turn. In each turn the corresponding player should choose a non-empty box A and choose another box B that B<A && (A+B)%2=1 && (A+B)%3=0. Then, take an arbitrary number (but not zero) of cards from box A to box B. The last one who can do a legal move wins. Alice is the first player. Please predict who will win the game.
Input
The first line contains an integer T (T<=100) indicating the number of test cases. The first line of each test case contains an integer n (1<=n<=10000). The second line has n integers which will not be bigger than 100. The i-th integer indicates the number of cards in the i-th box.
Output
For each test case, print the case number and the winner’s name in a single line. Follow the format of the sample output.
Sample Input
2
2
1 2
7
1 3 3 2 2 1 2
Sample Output
Case 1: Alice
Case 2: Bob
不太懂,但是写一下记录一下下。

#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

const int maxx=1e5+10;
int a[maxx];
int n;

int main()
{
	int t;
	while(scanf("%d",&t)!=EOF)
	{
		int c=0;
		while(t--)
		{
			
			int s1=0,s2=0,s3=0;
			int s;
			scanf("%d",&n);
			for(int i=1;i<=n;i++)
			scanf("%d",&a[i]);
			for(int i=2;i<=n;i+=6)
				s1^=a[i];
			for(int i=6;i<=n;i+=6)
				s2^=a[i];
			for(int i=5;i<=n;i+=6)
				s3^=a[i];
			s=s1^s2^s3;
			if(s)
				printf("Case %d: Alice\n",++c);
			else
				printf("Case %d: Bob\n",++c);
		}
	}
}

努力加油a啊,(o)/~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

starlet_kiss

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值