CF36D.New Game with a Chess Piece
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Petya and Vasya are inventing a new game that requires a rectangular board and one chess piece. At the beginning of the game the piece stands in the upper-left corner of the board. Two players move the piece in turns. Each turn the chess piece can be moved either one square to the right or one square down or jump k squares diagonally down and to the right. The player who can’t move the piece loses.

The guys haven’t yet thought what to call the game or the best size of the board for it. Your task is to write a program that can determine the outcome of the game depending on the board size.
佩佳和瓦夏正在发明一款新游戏,该游戏需要一个矩形棋盘和一枚棋子。游戏开始时,棋子位于棋盘的左上角。两名玩家轮流移动棋子。在每一轮中,棋子可以向右移动一格,或向下移动一格,或沿右下方对角线方向跳跃 k 格。无法继续移动棋子的玩家判负。

两人尚未决定该游戏的名称,也未确定最佳的棋盘尺寸。你的任务是编写一个程序,根据棋盘尺寸判断游戏的结果。
输入格式
The first input line contains two integers t and k (1 ≤ t ≤ 20, 1 ≤ k ≤ 109). Each of the following t lines contains two numbers n, m — the board’s length and width (1 ≤ n, m ≤ 109).
第一行输入包含两个整数 t 和 k(1 ≤ t ≤ 20,1 ≤ k ≤ 109)。接下来的 t 行中,每行包含两个数 n、m —— 表示棋盘的长和宽(1 ≤ n,m ≤ 109)。
输出格式
Output t lines that can determine the outcomes of the game on every board. Write «+» if the first player is a winner, and «-» otherwise.
输出 t 行,每行表示对应棋盘上游戏结果的判定:若先手玩家获胜,则输出 «+»;否则输出 «-»。
输入输出样例
输入#1
10 2 1 1 1 2 2 1 2 2 1 3 2 3 3 1 3 2 3 3 4 3
输出#1
- + + - - + - + + +
输入解题思路,AI测评打分。不知道怎么写?