博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Game
阅读量:6090 次
发布时间:2019-06-20

本文共 1854 字,大约阅读时间需要 6 分钟。

Game

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 50 Accepted Submission(s): 44
 
Problem Description
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
221 271 3 3 2 2 1 2
 
Sample Output
Case 1: AliceCase 2: Bob
 
Author
hanshuai@whu
 
Source
The 5th Guangting Cup Central China Invitational Programming Contest
 
Recommend
notonlysuccess
 
/*题意:1到n的盒子里,是空的或者装着卡片,每人轮流移动卡片,Alice先手,移动卡片的规则:每次选择一个A,然后选择一个B    要求 B
using namespace std;int n;int x;int res=0;int t;void init(){ res=0;}int main(){ // freopen("in.txt","r",stdin); scanf("%d",&t); for(int ca=1;ca<=t;ca++){ init(); scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&x); if(i%6==0||i%6==2||i%6==5) res^=x; } if(res) printf("Case %d: Alice\n",ca); else printf("Case %d: Bob\n",ca); } return 0;}

 

转载于:https://www.cnblogs.com/wuwangchuxin0924/p/6404142.html

你可能感兴趣的文章
无需编程操作和视觉系统,这款机器人就可灵活若蛇
查看>>
为什么量子力学和相对论有矛盾?超弦理论或将统一物理学
查看>>
wireshark解析自定义的protobuf协议
查看>>
如何处理CloudFoundry应用部署时遇到的254错误
查看>>
Lua模块的加载与内存释放
查看>>
受企业级客户和云服务提供商推动, Veeam第一季度业绩又获增长
查看>>
区块链应用 | 2018年区块链将步入实际应用阶段,区块链经济将重构商业逻辑
查看>>
面试中关于Java虚拟机(jvm)的问题看这篇就够了
查看>>
锐捷网络国际合作伙伴大会召开,“3+2+1”战略布局全球市场
查看>>
多隆:淘宝第一行代码撰写者的程序世界
查看>>
DRDS到MaxCompute(原ODPS)数据归档性能优化测试
查看>>
FastDFS安装配置
查看>>
DllMain和多线程死锁
查看>>
走进太平洋保险集团 ——信息化系统运维专场活动沙龙圆满举行
查看>>
里德•哈斯廷斯表示并不担心人工智能威胁人类
查看>>
URL中的特殊字符
查看>>
AOP动态代理解析4-jdk代理的实现
查看>>
5个国外免费图标搜索网站
查看>>
“神似充气娃娃”的人形机器人,made in China
查看>>
strncmp memcmp区别
查看>>