• Lyft Level 5 Challenge 2018


    http://codeforces.com/contest/1075/problem/A

    On a chessboard with a width of nn and a height of nn, rows are numbered from bottom to top from 11 to nn, columns are numbered from left to right from 11 to nn. Therefore, for each cell of the chessboard, you can assign the coordinates (r,c)(r,c), where rr is the number of the row, and cc is the number of the column.

    The white king has been sitting in a cell with (1,1)(1,1) coordinates for a thousand years, while the black king has been sitting in a cell with (n,n)(n,n) coordinates. They would have sat like that further, but suddenly a beautiful coin fell on the cell with coordinates (x,y)(x,y)...

    Each of the monarchs wanted to get it, so they decided to arrange a race according to slightly changed chess rules:

    As in chess, the white king makes the first move, the black king makes the second one, the white king makes the third one, and so on. However, in this problem, kings can stand in adjacent cells or even in the same cell at the same time.

    The player who reaches the coin first will win, that is to say, the player who reaches the cell with the coordinates (x,y)(x,y) first will win.

    Let's recall that the king is such a chess piece that can move one cell in all directions, that is, if the king is in the (a,b)(a,b) cell, then in one move he can move from (a,b)(a,b) to the cells (a+1,b)(a+1,b), (a1,b)(a−1,b), (a,b+1)(a,b+1), (a,b1)(a,b−1), (a+1,b1)(a+1,b−1), (a+1,b+1)(a+1,b+1), (a1,b1)(a−1,b−1), or (a1,b+1)(a−1,b+1). Going outside of the field is prohibited.

    Determine the color of the king, who will reach the cell with the coordinates (x,y)(x,y) first, if the white king moves first.

    Input

    The first line contains a single integer nn (2n10182≤n≤1018) — the length of the side of the chess field.

    The second line contains two integers xx and yy (1x,yn1≤x,y≤n) — coordinates of the cell, where the coin fell.

    Output

    In a single line print the answer "White" (without quotes), if the white king will win, or "Black" (without quotes), if the black king will win.

    You can print each letter in any case (upper or lower).

    Examples
    input
    Copy
    4
    2 3
    output
    Copy
    White
    input
    Copy
    5
    3 5
    output
    Copy
    Black
    input
    Copy
    2
    2 2
    output
    Copy
    Black

    代码:

    #include <bits/stdc++.h>
    using namespace std;
    
    long long N;
    long long x, y;
    
    int main() {
        cin >> N;
        cin >> x >> y;
        long long step1 = 0, step2 = 0;
        step1 = min(abs(x - 1), abs(y - 1)) + abs(x - y);
        step2 = min(abs(x - N), abs(y - N)) + abs(x - y);
        if(step1 <= step2)
            printf("White
    ");
        else
            printf("Black
    ");
        return 0;
    }
    

      

    AC 的第一道 Div.2 的题目 可能是本年度唯一一道吧 【微笑脸】

  • 相关阅读:
    确定比赛名次
    What Are You Talking About
    小兔的棋盘
    How Many Answers Are Wrong
    备份当前的ubuntu系统生成iso
    eclipse导入maven项目有时出现web.xml is missing的问题
    eclipse自动添加版权信息
    javac不是内部或外部命令
    linux目录权限
    python import error:no module named yaml
  • 原文地址:https://www.cnblogs.com/zlrrrr/p/9928121.html
Copyright © 2020-2023  润新知