当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2512:Chessboard in FEN

题目描述
In the FEN (Forsyth-Edwards Notation), a chessboard is described as follows:
  • The Board-Content is specified starting with the top row and ending with the bottom row.
  • Character / is used to separate data of adjacent rows.
  • Each row is specified from left to right.
  • White pieces are identified by uppercase piece letters: PNBRQK.
  • Black pieces are identified by lowercase piece letters: pnbrqk.
  • Empty squares are represented by the numbers one through eight.
  • A number used represents the count of contiguous empty squares along a row.
  • Each row's sum of numbers and characters must equal 8.

For example:
    5k1r/2q3p1/p3p2p/1B3p1Q/n4P2/6P1/bbP2N1P/1K1RR3

is the FEN notation description of the following chessboard:

The chessboard of the beginning of a chess game is described in FEN as:
    rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR

Your task is simple: given a chessboard description in a FEN notation you are asked to compute the number of unoccupied squares on the board which are not attacked by any piece.
输入解释
Input is a sequence of lines, each line containing a FEN description of a chessboard. Note that the description does not necessarily give a legal chess position. Input lines do not contain whitespace.
输出解释
For each line of input, output one line containing an integer which gives the number of unoccupied squares which are not attacked.
输入样例
5k1r/2q3p1/p3p2p/1B3p1Q/n4P2/6P1/bbP2N1P/1K1RR3
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR
输出样例
3
16

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2512

最后修改于 2020-10-29T06:34:32+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536