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

建议使用的浏览器:

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

6886:Tic-Tac-Toe-Nim

题目描述
Alice and Bob are playing a new game that is a mixture of tic-tac-toe and nim.

There are $9$ piles of stones forming a $3*3$ grid. Players take turns to remove the stones: in each turn, the player choose a remaining pile and remove a positive number of stones from it. Alice goes first. The first player to remove a pile so that a new empty row or column is formed wins. Notice that player does NOT have to be the one to remove all three piles to win, and diagonals does NOT count as a win.

However, to speed up the game, both players have decided they will always remove the whole pile they choose in their respective first turn, instead of removing only part of the pile. Now Alice wants to know how many different moves can she choose in the first turn so that she can still ensure her victory.
输入解释
The first line contains one integer $T$ ($1 \leq T \leq 500000$), the number of test cases.
For each test case, there are $3$ lines, each contains $3$ integers $a_{ij}$ ($1 \leq a_{ij} \leq 10^9$), denoting the number of stones in each pile.
输出解释
For each test case, output one integer denoting the answer. Output $0$ when Alice can not win in the situation.
输入样例
2
1 1 1
1 1 1
1 1 1
1 2 3
4 5 6
7 8 9
输出样例
9
7
来自杭电HDUOJ的附加信息
Recommend IceyWang

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

源链接: HDU-6886

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

共提交 0

通过率 --%
时间上限 内存上限
7000/3500MS(Java/Others) 262144/262144K(Java/Others)