CF519A.A and B and Chess

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

A 和 B 正在为编程竞赛做准备。

为了训练逻辑思维并更好地解决问题,A 和 B 决定下国际象棋。对局过程中,A 想知道此时谁的局势更强。

每种棋子的权重如下:

  • 后(Queen)的权重为 9,
  • 车(Rook)的权重为 5,
  • 象(Bishop)的权重为 3,
  • 马(Knight)的权重为 3,
  • 兵(Pawn)的权重为 1,
  • 王(King)的权重在评估局势时不予考虑。

一名选手的总权重等于其所有仍在棋盘上的棋子的权重之和。

由于 A 不喜欢计算,他请你帮忙判断哪位选手的局势总权重大。

输入格式

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.

输入包含八行,每行八个字符——表示棋盘的状态。

棋盘上的白方棋子用大写字母标记,黑方棋子用小写字母标记。

白方棋子的表示方式如下:皇后为 'Q',车为 'R',象为 'B',马为 'N',兵为 'P',王为 'K'。

黑方棋子相应地表示为 'q'、'r'、'b'、'n'、'p'、'k'。

棋盘上的空格用 '.'(英文句点)表示。

所给的国际象棋局面不一定能在真实对局中出现。具体而言,各类棋子的数量可以是任意的(包括零个),王可能正被将军,等等。

输出格式

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.

如果白方棋子位置的权重大于黑方棋子位置的权重,则输出 "White"(不带引号);如果黑方棋子位置的权重大于白方棋子位置的权重,则输出 "Black";如果白方与黑方棋子位置的权重相等,则输出 "Draw"。

输入输出样例

  • 输入#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.

在第一个测试样例中,白方棋子位置的权重为 9,黑方棋子位置的权重为 5。

在第二个测试样例中,黑方与白方棋子位置的权重均为 39。

在第三个测试样例中,白方棋子位置的权重为 9,黑方棋子位置的权重为 16。

输入解题思路,AI测评打分。不知道怎么写?

首页