[Codeforces493D] Vasya and Chess

描述 Description

Vasya decided to learn to play chess. Classic chess doesn’t seem interesting to him, so he plays his own sort of chess.

The queen is the piece that captures all squares on its vertical, horizontal and diagonal lines. If the cell is located on the same vertical, horizontal or diagonal line with queen, and the cell contains a piece of the enemy color, the queen is able to move to this square. After that the enemy’s piece is removed from the board. The queen cannot move to a cell containing an enemy piece if there is some other piece between it and the queen.

There is an n × n chessboard. We’ll denote a cell on the intersection of the r-th row and c-th column as (r, c). The square (1, 1) contains the white queen and the square (1, n) contains the black queen. All other squares contain green pawns that don’t belong to anyone.

The players move in turns. The player that moves first plays for the white queen, his opponent plays for the black queen.

On each move the player has to capture some piece with his queen (that is, move to a square that contains either a green pawn or the enemy queen). The player loses if either he cannot capture any piece during his move or the opponent took his queen during the previous move.

Help Vasya determine who wins if both players play with an optimal strategy on the board n × n.

输入格式 InputFormat

The input contains a single number n (2 ≤ n ≤ 109) — the size of the board.

输出格式 OutputFormat

On the first line print the answer to problem — string “white” or string “black”, depending on who wins if the both players play optimally.

If the answer is “white”, then you should also print two integers r and c representing the cell (r, c), where the first player should make his first move to win. If there are multiple such cells, print the one with the minimum r. If there are still multiple squares, print the one with the minimum c.

样例输入 SampleInput


样例输出 SampleOutput

1 2

Codeforces 493D

代码 Code

因为黑白均走最优策略,且最开始棋盘布满障碍物,所以 yy 一下就可以知道只跟两者最开始的距离有关系了。。。

#include <stdio.h>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
#define ll long long
int i,j,t,n,m,l,r,k,z,y,x;
int main()
    if (n&1) printf("black\n");
    else printf("white\n%d %d\n",1,2);
    return 0;