CF1075A.The King's Race

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

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), (a−1,b)(a - 1,b), (a,b+1)(a,b + 1), (a,b−1)(a,b - 1), (a+1,b−1)(a + 1,b - 1), (a+1,b+1)(a + 1,b + 1), (a−1,b−1)(a - 1,b - 1), or (a−1,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.

在一个 n×nn \times n 的棋盘上,行从下到上编号为 11 到 nn,列从左到右编号为 11 到 nn。因此,棋盘上的每个格子都可以用坐标 (r,c)(r,c) 表示,其中 rr 为行号,cc 为列号。

白方国王已在坐标为 (1,1)(1,1) 的格子中静坐了千年,而黑方国王则一直在坐标为 (n,n)(n,n) 的格子中静坐。若无意外,他们本会继续如此静坐下去,但突然一枚美丽的硬币落在了坐标为 (x,y)(x,y) 的格子上……

两位君主都想得到这枚硬币,于是他们决定依据略微修改过的国际象棋规则展开一场竞速:

与国际象棋一样,白方国王先走第一步,黑方国王走第二步,白方国王走第三步,依此类推。然而,在本题中,双方国王可以同时位于相邻的格子,甚至可以同时位于同一格子。

率先抵达硬币所在格子的玩家获胜,即:首位到达坐标为 (x,y)(x,y) 的格子的玩家获胜。

请回忆:国王是一种可在所有方向上每次移动一格的棋子。也就是说,若国王位于 (a,b)(a,b) 格,则其一步之内可从 (a,b)(a,b) 移动至以下格子之一:(a+1,b)(a + 1,b)、(a−1,b)(a - 1,b)、(a,b+1)(a,b + 1)、(a,b−1)(a,b - 1)、(a+1,b−1)(a + 1,b - 1)、(a+1,b+1)(a + 1,b + 1)、(a−1,b−1)(a - 1,b - 1) 或 (a−1,b+1)(a - 1,b + 1)。禁止移出棋盘边界。

请判断:若白方国王先行,哪一方(白方或黑方)的国王将率先抵达坐标为 (x,y)(x,y) 的格子?

输入格式

The first line contains a single integer nn (2≤n≤10182 \le n \le 10^{18}) — the length of the side of the chess field.

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

第一行包含一个整数 nn(2≤n≤10182 \le n \le 10^{18})——棋盘边长。

第二行包含两个整数 xx 和 yy(1≤x,y≤n1 \le x,y \le n)——硬币落下的格子坐标。

输出格式

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

在一行中输出答案“White”(不带引号),如果白方国王获胜;或输出“Black”(不带引号),如果黑方国王获胜。

每个字母可以是大写或小写。

输入输出样例

  • 输入#1

    4
    2 3

    输出#1

    White
  • 输入#2

    5
    3 5

    输出#2

    Black
  • 输入#3

    2
    2 2

    输出#3

    Black

说明/提示

An example of the race from the first sample where both the white king and the black king move optimally:

  1. The white king moves from the cell (1,1)(1,1) into the cell (2,2)(2,2).
  2. The black king moves form the cell (4,4)(4,4) into the cell (3,3)(3,3).
  3. The white king moves from the cell (2,2)(2,2) into the cell (2,3)(2,3). This is cell containing the coin, so the white king wins.

An example of the race from the second sample where both the white king and the black king move optimally:

  1. The white king moves from the cell (1,1)(1,1) into the cell (2,2)(2,2).
  2. The black king moves form the cell (5,5)(5,5) into the cell (4,4)(4,4).
  3. The white king moves from the cell (2,2)(2,2) into the cell (3,3)(3,3).
  4. The black king moves from the cell (4,4)(4,4) into the cell (3,5)(3,5). This is the cell, where the coin fell, so the black king wins.

In the third example, the coin fell in the starting cell of the black king, so the black king immediately wins.

第一个样例中双方国王均采取最优走法时的追逐过程示例如下:

  1. 白方国王从格子 (1,1)(1,1) 移动到格子 (2,2)(2,2)。
  2. 黑方国王从格子 (4,4)(4,4) 移动到格子 (3,3)(3,3)。
  3. 白方国王从格子 (2,2)(2,2) 移动到格子 (2,3)(2,3)。该格子中放置有硬币,因此白方国王获胜。

第二个样例中双方国王均采取最优走法时的追逐过程示例如下:

  1. 白方国王从格子 (1,1)(1,1) 移动到格子 (2,2)(2,2)。
  2. 黑方国王从格子 (5,5)(5,5) 移动到格子 (4,4)(4,4)。
  3. 白方国王从格子 (2,2)(2,2) 移动到格子 (3,3)(3,3)。
  4. 黑方国王从格子 (4,4)(4,4) 移动到格子 (3,5)(3,5)。该格子为硬币掉落位置,因此黑方国王获胜。

在第三个样例中,硬币恰好掉落在黑方国王的起始格子上,因此黑方国王立即获胜。

输入解题思路,AI测评打分。不知道怎么写?

首页