A. The King's Race

                                                                                                                                                                           A. The King's Race
 

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
 4
2 3
output
White
input
5
3 5
output
Black
input
2
2 2
output
Black

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

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

 1 #include<bits/stdc++.h>
 2 
 3 using namespace std;
 4 typedef long  long ll;
 5 ll n,x,y;
 6 
 7 int main()
 8 {
 9     std::ios::sync_with_stdio(false),cin.tie(0);
10     //freopen("in.txt","r",stdin);
11     cin>>n>>x>>y;
12     if(x+y>n+1)cout<<"Black"<<endl;
13     else cout<<"White"<<endl;
14     return 0;
15 }

 

转载于:https://www.cnblogs.com/kuroko-ghh/p/9960431.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
解决这个问题King Julien rules the Madagascar island whose primary crop is coconuts. If the price of coconuts is P , then King Julien’s subjects will demand D(P ) = 1200 − 100P coconuts per week for their own use. The number of coconuts that will be supplied per week by the island’s coconut growers is S(p) = 100P. (a) (2 pts) Calculate the equilibrium price and quantity for coconuts. (b) (2 pts) One day, King Julien decided to tax his subjects in order to collect coconuts for the Royal Larder. The king required that every subject who consumed a coconut would have to pay a coconut to the king as a tax. Thus, if a subject wanted 5 coconuts for himself, he would have to purchase 10 coconuts and give 5 to the king. When the price that is received by the sellers is pS, how much does it cost one of the king’s subjects to get an extra coconut for himself? (c) (3 pts) When the price paid to suppliers is pS, how many coconuts will the king’s subjects demand for their own consumption (as a function of pS)? 2 (d) (2 pts) Under the above coconut tax policy, determine the total number of coconuts demanded per week by King Julien and his subjects as a function of pS. (e) (3 pts) Calculate the equilibrium value of pS, the equilibrium total number of coconuts produced, and the equilibrium total number of coconuts consumed by Julien’s subjects. (f) (5 pts) King Julien’s subjects resented paying the extra coconuts to the king, and whispers of revolution spread through the palace. Worried by the hostile atmosphere, the king changed the coconut tax. Now, the shopkeepers who sold the coconuts would be responsible for paying the tax. For every coconut sold to a consumer, the shopkeeper would have to pay one coconut to the king. For this new policy, calculate the number of coconuts being sold to the consumers, the value per coconuts that the shopkeepers got after paying their tax to the king, and the price payed by the consumers.
03-07
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值