D. Vasya and Chess
 

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.

Input

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

Output

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.

Sample test(s)
input
  1. 2
output
  1. white
    1 2
input
  1. 3
output
  1. black
Note

In the first sample test the white queen can capture the black queen at the first move, so the white player wins.

In the second test from the statement if the white queen captures the green pawn located on the central vertical line, then it will be captured by the black queen during the next move. So the only move for the white player is to capture the green pawn located at (2, 1).

Similarly, the black queen doesn't have any other options but to capture the green pawn located at (2, 3), otherwise if it goes to the middle vertical line, it will be captured by the white queen.

During the next move the same thing happens — neither the white, nor the black queen has other options rather than to capture green pawns situated above them. Thus, the white queen ends up on square (3, 1), and the black queen ends up on square (3, 3).

In this situation the white queen has to capture any of the green pawns located on the middle vertical line, after that it will be captured by the black queen. Thus, the player who plays for the black queen wins.

  1. ///meek
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4.  
  5. typedef long long ll;
  6. #define mem(a) memset(a,0,sizeof(a))
  7. #define pb push_back
  8. inline ll read()
  9. {
  10. ll x=,f=;char ch=getchar();
  11. while(ch<''||ch>''){
  12. if(ch=='-')f=-;ch=getchar();
  13. }
  14. while(ch>=''&&ch<=''){
  15. x=x*+ch-'';ch=getchar();
  16. }return x*f;
  17. }
  18. //****************************************
  19. const int N=;
  20. #define mod 10000007
  21. #define inf 2000000007
  22. #define maxn 10000
  23. int main() {
  24. int n;
  25. cin>>n;
  26. if(n%==)
  27. cout<<"black"<<endl;
  28. else
  29. {
  30. cout<<"white"<<endl;
  31. cout<<"1 2"<<endl;
  32. }
  33. return ;
  34.  
  35. }

Codeforces Round #281 (Div. 2) D. Vasya and Chess 博弈的更多相关文章

  1. Codeforces Round #281 (Div. 2) D. Vasya and Chess 水

    D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  2. Codeforces Round #281 (Div. 2) D. Vasya and Chess 镜面对称 博弈论

    D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  3. Codeforces Round #281 (Div. 2) B. Vasya and Wrestling 水题

    B. Vasya and Wrestling 题目连接: http://codeforces.com/contest/493/problem/B Description Vasya has becom ...

  4. Codeforces Round #281 (Div. 2) C. Vasya and Basketball 二分

    C. Vasya and Basketball time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  5. Codeforces Round #281 (Div. 2) C. Vasya and Basketball 暴力水题

    C. Vasya and Basketball time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  6. Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力水题

    A. Vasya and Football time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  7. Codeforces Round #281 (Div. 2) C. Vasya and Basketball 排序

    C. Vasya and Basketball   Vasya follows a basketball game and marks the distances from which each te ...

  8. Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力

    A. Vasya and Football   Vasya has started watching football games. He has learned that for some foul ...

  9. Codeforces Round #281 (Div. 2) A. Vasya and Football(模拟)

    简单题,却犯了两个错误导致WA了多次. 第一是程序容错性不好,没有考虑到输入数据中可能给实际已经罚下场的人再来牌,这种情况在system测试数据里是有的... 二是chronologically这个词 ...

随机推荐

  1. MVC系列学习(十二)-服务端的验证

    在前一讲,提到过,客户端的东西永远可以造假,所以我们还要在服务端进行验证 注意:先加载表单,后添加js文件,才能有效:而先加载js,后添加表单,是没有效果的 1.视图与Model中的代码如下 2.一张 ...

  2. Java系列学习(一)-JDK下载与安装

    1.Java语言平台版本 J2SE:Java 2 Platform Standard Edition,java平台标准版 J2ME:Java 2 Platform Micro Edition,java ...

  3. Android项目实战_手机安全卫士拦截骚扰

    ###1.骚扰拦截需求分析1.界面1.1 黑名单列表界面1.2 添加黑名单界面2.功能2.1 黑名单的添加.删除2.2 拦截电话2.3 拦截短信 ###2.黑名单数据库的创建1.分析需要的字段id 主 ...

  4. 【PL/SQL】九九乘法口诀表

    --输出屏幕信息 SET serveroutput ON; --打印口诀表 DECLARE V_NUMBER1 ); --外层循环变量 V_NUMBER2 ); --内层循环变量 BEGIN .. - ...

  5. 常用的SSH注解标签

    常用的SSH注解标签 1.Spring的注解 关于配Bean用的        @Component        @Controller @Service @Repository        作用 ...

  6. VS2013支持多字节

    使用插件 下载地址:https://www.microsoft.com/zh-cn/search/DownloadResults.aspx?rf=sp&q=mbcs

  7. CentOS7将firewall切换为iptables防火墙

  8. DOS批处理命令-字符串操作

    1.字符串替换 语法结构:%变量名:替换前=替换后% @set str=teh cat in teh hat @echo %str% @set str=%str:teh=the% @echo %str ...

  9. django-Celery分布式队列简单使用

    介绍: Celery 是一个简单.灵活且可靠的,处理大量消息的分布式系统,并且提供维护这样一个系统的必需工具. 它是一个专注于实时处理的任务队列,同时也支持任务调度. worker:是一个独立的进程, ...

  10. 11.11如何卖到一个亿:从0到1的电商爆品打造术 电子书 PDF

    内容转自:https://download.csdn.net/download/chenyao1994/11191034 下载地址:https://pan.baidu.com/s/1uQ1cjm9QH ...