当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5795:A Simple Nim

题目描述
Two players take turns picking candies from n heaps,the player who picks the last one will win the game.On each turn they can pick any number of candies which come from the same heap(picking no candy is not allowed).To make the game more interesting,players can separate one heap into three smaller heaps(no empty heaps)instead of the picking operation.Please find out which player will win the game if each of them never make mistakes.
输入解释
Intput contains multiple test cases. The first line is an integer $1\le T\le 100$, the number of test cases. Each case begins with an integer n, indicating the number of the heaps, the next line contains N integers $s[0],s[1], ....,s[n-1]$, representing heaps with $s[0],s[1], ...,s[n-1]$ objects respectively.$(1\le n\le 10^6,1\le s[i]\le 10^9)$
输出解释
For each test case,output a line whick contains either"First player wins."or"Second player wins".
输入样例
2
2
4 4
3
1 2 4
输出样例
Second player wins.
First player wins.
来自杭电HDUOJ的附加信息
Author UESTC
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5795

最后修改于 2020-10-25T23:25:43+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)