302672: CF519A. A and B and Chess

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A and B and Chess

题意翻译

题目描述 A和B正在准备参加编程比赛。 为了锻炼他们的逻辑思维能力从而更好地解决问题,A和B决定来下棋。在游戏期间,A突然想要知道哪位玩家占得了优势。 对于每个棋子我们知道它们的权势值: 皇后的值是9; 车的值是5; 象(相)的值是3; 骑士的值也是3; 卒(兵)的值是1; 国王的值不考虑在优势评估中. 一个玩家的优势值是他在棋盘上所有棋子权势值的总和。 因为A不喜欢算数,所以他请求你告诉他哪位玩家的占有优势?(即优势值更大) 输入格式 输入一共八行,八列,描述这个棋盘。 白方的棋子如要表示均用大写字母,黑方则用的是小写字母。 白方棋子规定如下:皇后用Q表示,车用R表示,象用B表示,骑士用N表示,卒用P表示,国王用K表示。 黑方棋子则相反,用小写字母:q,r,b,n,p,k。 一个空的棋盘格子用"."(一个点)表示 无需考虑棋盘上的情况能否在真实的游戏中实现,只需计算出优势总值再比较即可。 输出格式 如果白方的优势总值更大,则输出"White",如果黑方的优势总值更大,则输出"Black"。如果总值相等,那么请输出"Draw"。 说明 对于样例一,白方总值为9,黑方总值为5,所以输出"White"。 对于样例二,两方总值均为39,输出"Draw"。 对于样例三,白方总值为9,黑方总值为16,输出"Black"。 Translated by @lonelysir

题目描述

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.

输入输出格式

输入格式


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.

输出格式


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.

输入输出样例

输入样例 #1

...QK...
........
........
........
........
........
........
...rk...

输出样例 #1

White

输入样例 #2

rnbqkbnr
pppppppp
........
........
........
........
PPPPPPPP
RNBQKBNR

输出样例 #2

Draw

输入样例 #3

rppppppr
...k....
........
........
........
........
K...Q...
........

输出样例 #3

Black

说明

In the first test sample the weight of the position of the white pieces equals to 9, the weight of the position of the black pieces equals 5. In the second test sample the weights of the positions of the black and the white pieces are equal to 39. In the third test sample the weight of the position of the white pieces equals to 9, the weight of the position of the black pieces equals to 16.

Input

题意翻译

题目描述 A和B正在准备参加编程比赛。 为了锻炼他们的逻辑思维能力从而更好地解决问题,A和B决定来下棋。在游戏期间,A突然想要知道哪位玩家占得了优势。 对于每个棋子我们知道它们的权势值: 皇后的值是9; 车的值是5; 象(相)的值是3; 骑士的值也是3; 卒(兵)的值是1; 国王的值不考虑在优势评估中. 一个玩家的优势值是他在棋盘上所有棋子权势值的总和。 因为A不喜欢算数,所以他请求你告诉他哪位玩家的占有优势?(即优势值更大) 输入格式 输入一共八行,八列,描述这个棋盘。 白方的棋子如要表示均用大写字母,黑方则用的是小写字母。 白方棋子规定如下:皇后用Q表示,车用R表示,象用B表示,骑士用N表示,卒用P表示,国王用K表示。 黑方棋子则相反,用小写字母:q,r,b,n,p,k。 一个空的棋盘格子用"."(一个点)表示 无需考虑棋盘上的情况能否在真实的游戏中实现,只需计算出优势总值再比较即可。 输出格式 如果白方的优势总值更大,则输出"White",如果黑方的优势总值更大,则输出"Black"。如果总值相等,那么请输出"Draw"。 说明 对于样例一,白方总值为9,黑方总值为5,所以输出"White"。 对于样例二,两方总值均为39,输出"Draw"。 对于样例三,白方总值为9,黑方总值为16,输出"Black"。 Translated by @lonelysir

加入题单

上一题 下一题 算法标签: