The King's Race【数学】

版权声明:版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/YT201758501112/article/details/83901110

The King's Race

 CodeForces - 1075A 

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.

Input

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

The second line contains two integers xx and yy (1≤x,y≤n1≤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

4
2 3

Output

White

Input

5
3 5

Output

Black

Input

2
2 2

Output

Black

Note

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.

题目大意:先输入棋盘的大小n,代表有一n*n的棋盘,在输入一个坐标x,y,白棋从(1,1)先出发,黑棋从(n,n)出发,问谁能先到达指定的位置。

解决方法:其实可以在棋盘的左上和右下连起来,求出这条对角线的方程,不难发现当所要到达的点在对角线以上时总是黑棋获胜,当其在对角线上或在对角线以下时总是白棋获胜,所以判断一下位置即可。

AC代码:

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <bitset>
#include <set>
#include <utility>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
#define inf 0x3f3f3f3f
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define lep(i,l,r) for(int i=l;i>=r;i--)
#define ms(arr) memset(arr,0,sizeof(arr))
//priority_queue<int,vector<int> ,greater<int> >q;
const int maxn = (int)1e5 + 5;
const ll mod = 1e9+7;
int main() 
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(0),cin.tie(0);
    ll n;
    ll a,b;
    cin>>n;
    cin>>a>>b;
    if(a+b>n+1)
	    cout<<"Black"<<endl;
	else
		cout<<"White"<<endl;
    return 0;
}

猜你喜欢

转载自blog.csdn.net/YT201758501112/article/details/83901110
今日推荐