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

建议使用的浏览器:

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

1182:Chessmen

题目描述
You know, Harry, Ron, and Hermione thought they had found some Snape's cabal. They tried to tail after Snape until they went into a strange room.
The room was so dark they couldn't see anything at all. But as they stepped into it, light suddenly flooded the room to reveal an astonishing sight.
They were standingon the edge of a huge chessboard, behind the black chessmen, which were all taller than they were and carved from what looked like black stone. Facing them, way across the room, were the white pieces. Harry, Ron and Hermione shivered slightly - the towering white chessmen had no faces.
'Now what do we do?' harry whispered.
'It's obvious, isn't it?' said Ron. 'We've got to play our way across the room.'
Behind the white pieces they could see another door.
'How?' said Hermione nervously.
'I think,' said Ron, 'we're going to have to be chessmen.'
He walked up to a black knight and put his hand out to touch the knight's horse. At once, the stone sprang to life. The horse pawed the ground and the knight turned his helmeted head to look down at Ron.
'Do we - er - have to join you to get across?'
The black knight nodded. Ron turned to the other two.
'This wants thinking about ...' he said. 'I suppose we've got to take the place of the back pieces ...'
Harry and Hermione stayed quiet, watching Ron think. Finally he said, 'Now, don't be offended or anything, but neither of you are that good at chess -'
'We're not offended,' said Harry quickly. 'Just tell us what to do.'
'Well, Harry, you take the place of that bishop, and Hermione, you go next to him instead of that castle.'
'What about you?'
'I'm going to be a knight,' said Ron.
The chessmen seemed to have been listening, because at these words a knight, a bishop and a castle turned there backs on the white pieces and walked off the board leaving three empty squares which Harry, Ron and Hermione took.
'White always plays first in chess,' said Ron,peering across the board. 'Yes ... look ...'
A white pawn had moved forward two squares.


Now Ron decided to direct the black pieces, but he met a trouble. All the chessmen were so tall that he can't know the whole board. He must memorize the board all by himself if you don't help him. Could you write a magic for him?
输入解释
The input will contain several chess manuals. Each one is in the format as sample input.
O-O and O-O-O will not appear.
Notice that black side may haven't a move in the last turn.
The input will always be correct,and end of -1.
输出解释
Print the chessboard in FEN.
(see also the Hint)
输入样例
0 Pe2-e4 pd7-d5
1 Pd2-d3 pf7-f5
2 Pf2-f3 pe7-e6
3 Pe4xd5 pe6xd5
4 Pc2-c4 pd5xc4
5 Pd3xc4 qd8-e7
6 Ng1-e2
输出样例
rnb1kbnr/ppp1q1pp/8/5p2/2P5/5P2/PP2N1PP/RNBQKB1R


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
来自杭电HDUOJ的附加信息
Recommend JGShining

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 Gardon-DYGG Contest 1

源链接: HDU-1182

最后修改于 2020-10-25T22:42:46+00:00 由爬虫自动更新

共提交 118

通过率 69.49%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/32768K(Java/Others)