CF36D.New Game with a Chess Piece

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

注意这题要加上这个:

freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);

输入格式

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 kk 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.

输出格式

The first input line contains two integers tt and kk ( 1<=t<=201<=t<=20 , 1<=k<=1091<=k<=10^{9} ). Each of the following tt lines contains two numbers nn , mm — the board’s length and width ( 1<=n,m<=1091<=n,m<=10^{9} ).

输入输出样例

  • 输入#1

    10 2
    1 1
    1 2
    2 1
    2 2
    1 3
    2 3
    3 1
    3 2
    3 3
    4 3
    

    输出#1

    -
    +
    +
    -
    -
    +
    -
    +
    +
    +
    
首页