Slime and Stones

TimeLimit:1000MS  MemoryLimit:65536KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
Orac and Slime are playing a game.

There are two groups of stones, the first group contains $a$ stones and the second contains $b$ stones. Orac and Slime operate them by turns in the game. For each operation, they have two choices:

1. Pick up any number of stones from a certain group;

2. Pick up $x$ stones from the first group and $y$ from the second group, which $x,y$ satisfy $|x-y|\le k$. $k$ is a given constant.

Notice that not picking up any stone in an operation is not allowed. If there is no stone left in both groups at the beginning of one's turn, he loses the game.

Orac would like to know whether there exists a winning strategy for him if he operates first. They will play many times, so he will make multiple queries.
Input
The first line contains one integer $T$($1\le T\le 10^5$), which stands for the number of queries that Orac makes.
In the following $T$ lines, each line contains three integer $a,b,k$($1\le a\le 10^8, 1\le b\le 10^8, 0\le k\le 10^8$).
Output
The output contains $T$ lines, with an integer $0$ or $1$ in each line, stand for there exist/not exist a winning strategy for the given situation.
SampleInput
4
1 2 0
2 4 0
1 2 1
2 6 1
SampleOutput
0
1
1
0

 Hint In the first query, if Orac picks up all the stones from a group, Slime will pick up all the stones from the other group, and if Orac picks up a stone from the second group, Slime will pick up a stone from both groups.
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: