A and B and Chess
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

A and B are preparing themselves for programming contests.

To train their logical thinking and solve problems better, A and B decided to play chess. During the game A wondered whose position is now stronger.

For each chess piece we know its weight:

  • the queen's weight is 9,
  • the rook's weight is 5,
  • the bishop's weight is 3,
  • the knight's weight is 3,
  • the pawn's weight is 1,
  • the king's weight isn't considered in evaluating position.

The player's weight equals to the sum of weights of all his pieces on the board.

As A doesn't like counting, he asked you to help him determine which player has the larger position weight.

Input

The input contains eight lines, eight characters each — the board's description.

The white pieces on the board are marked with uppercase letters, the black pieces are marked with lowercase letters.

The white pieces are denoted as follows: the queen is represented is 'Q', the rook — as 'R', the bishop — as'B', the knight — as 'N', the pawn — as 'P', the king — as 'K'.

The black pieces are denoted as 'q', 'r', 'b', 'n', 'p', 'k', respectively.

An empty square of the board is marked as '.' (a dot).

It is not guaranteed that the given chess position can be achieved in a real game. Specifically, there can be an arbitrary (possibly zero) number pieces of each type, the king may be under attack and so on.

Output

Print "White" (without quotes) if the weight of the position of the white pieces is more than the weight of the position of the black pieces, print "Black" if the weight of the black pieces is more than the weight of the white pieces and print "Draw" if the weights of the white and black pieces are equal.

Sample test(s)
input
...QK...
........
........
........
........
........
........
...rk...
output
White
input
rnbqkbnr
pppppppp
........
........
........
........
PPPPPPPP
RNBQKBNR
output
Draw
input
rppppppr
...k....
........
........
........
........
K...Q...
........
output
Black

水题。。。MAP第一发
 #include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cctype>
#include <queue>
#include <map>
using namespace std; const int SIZE = ;
char MAP[SIZE][SIZE];
int main(void)
{
map<char,int> white;
map<char,int> black;
white['Q'] = ;
white['R'] = ;
white['B'] = ;
white['N'] = ;
white['P'] = ;
white['K'] = ; black['q'] = ;
black['r'] = ;
black['b'] = ;
black['n'] = ;
black['p'] = ;
white['k'] = ; int sum_w,sum_b;
char ch;
sum_w = sum_b = ;
for(int i = ;i < ;i ++)
for(int j = ;j < ;j ++)
{
scanf(" %c",&ch);
if(islower(ch))
sum_b += black[ch];
else if(isupper(ch))
sum_w += white[ch];
}
if(sum_w > sum_b)
puts("White");
else if(sum_w < sum_b)
puts("Black");
else
puts("Draw"); return ;
}

CF A and B and Chess的更多相关文章

  1. CF 560e Gerald and Giant Chess

    题意:在h×w的棋盘中从左上角走到右下角,只能向右或向下走,有n个点不可以经过,一共有多少种方案. 解法:dp.先对点按横坐标排序(横坐标相等按纵坐标,也可以反过来)dp[i]表示不经过其他非法点走到 ...

  2. Solution -「CF 793G」Oleg and Chess

    \(\mathcal{Description}\)   Link.   给一个 \(n\times n\) 的棋盘,其中 \(q\) 个互不重叠的子矩阵被禁止放棋.问最多能放多少个互不能攻击的车.   ...

  3. CF 559C - Gerald and Giant Chess (组合计数)

    \(C_{x+y}^y\)的公式,DP容斥删多余贡献. #include <cstdio> #include <iostream> #include <cstring&g ...

  4. 20180520模拟赛T3——chess

    [问题描述] 小美很喜欢下象棋. 而且她特别喜欢象棋中的马. 她觉得马的跳跃方式很独特.(以日字格的方式跳跃) 小芳给了小美一张很大的棋盘,这个棋盘是一个无穷的笛卡尔坐标. 一开始\(time=0\) ...

  5. ATC/TC/CF

    10.25 去打 CF,然后被 CF 打了. CF EDU 75 A. Broken Keyboard 精神恍惚,WA 了一发. B. Binary Palindromes 比赛中的憨憨做法,考虑一个 ...

  6. ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'

    凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...

  7. hdu4405 Aeroplane chess

    Aeroplane chess Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  8. HDU 5742 Chess SG函数博弈

    Chess Problem Description   Alice and Bob are playing a special chess game on an n × 20 chessboard. ...

  9. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

随机推荐

  1. RHEL6.4 KVM 桥接上网的设置

    关闭网络管理器 chkconfig NetworkManager off  ##和桥接有冲突,要关闭 service NetworkManager stop   修改eth0为物理网口,br0为桥接网 ...

  2. 问题-FireDAC连接Sqlite3提示“unable to open database file”

    相关资料:http://www.dfwlt.com/forum.php?mod=viewthread&tid=1497&extra= 问题现象:FireDAC连接Sqlite3在开发电 ...

  3. JSF 2 dropdown box example

    In JSF, <h:selectOneMenu /> tag is used to render a dropdown box – HTML select element with &q ...

  4. C++常用容器

    vector 顺序容器,和数组类似,可从尾部快速的插入和删除,可随机访问. vector的常用成员函数: #include<vector> std::vector<type> ...

  5. .Net 代码安全保护产品DNGuard HVM使用

    前辈人物写的程序啊! 官方网站:http://www.dnguard.net/index.aspx 官方博客:http://www.cnblogs.com/rick/ (很久没更新了) 原文http: ...

  6. 数据库存取缓冲区的LRU与MRU算法

    数据库存取缓冲区的LRU与MRU算法 1.Cache Hit and Cache Miss 当使用者第一次向数据库发出查询数据的请求的时候,数据库会先在缓冲区中查找该数据,如果要访问的数据恰好已经在缓 ...

  7. C++ 动态创建对象

    转自:http://www.cnblogs.com/jisi5789/p/3190353.html 回顾前面的文章,实现了一个简单工厂模式来创建不同类对象,但由于c++没有类似new "Ci ...

  8. Spring+Ibatis集成开发实例

    首先简历数据库demo(本文选mysql) 数据库脚本: CREATE TABLE `ibatis` (  `id` varchar(20) NOT NULL,  `name` varchar(20) ...

  9. android数据库操作之直接读取db文件

    在对数据库操作时,常用的有两种方法: 1.在代码中建库.建表: 2.直接将相关库.表建立好,将db文件拷贝至assets目录下:     现在来看看第二种方法:   private String Ge ...

  10. iOS开发——常识swift篇&随机数获取

    随机数获取   arc4random()这个全局函数会生成9位数的随机整数   1,下面是使用arc4random函数求一个1~100的随机数(包括1和100)     var temp:Int = ...