Problem 1977 --Border

1977: Border

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $1$ 正确数量 $1$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
You are to write a program that draws a border around a closed path into a bitmap, as displayed in the
following figure:
The path is closed and runs along the grid lines, i.e. between the squares of the grid. The path runs
counter-clockwise, so if following the path is considered as going ” forward ” , the border pixels are always
to the ” right ” of the path. The bitmap always covers 32 by 32 squares and has its lower left corner at (0,0).
You can safely assume that the path never touches the bounding rectangle of the bitmap and never
touches or crosses itself. Note that a bit gets set if it is on the outside of the area surrounded by the path
and if at least one of its edges belongs to the path, but not if only one of its corners is in the path. (A look
at the convex corners in the figure should clarify that statement.)

The first line of the input contains the number of test cases in the file. Each test case that follows
consists of two lines. The first line of each case contains two integer numbers x and y specifying the
starting point of the path. The second line contains a string of variable length. Every letter in the string
symbolizes a move of length one along the grid. Only the letters `W' (``west''), `E' (``east''), `N' (``north''),
`S' (``south''), and `.' (``end of path'', no move) appear in the string. The end-of-path character (`.') is immediately followed by the end of the line.

For each test case, output a line with the number of the case (`Bitmap #1', `Bitmap #2', etc.). For each
row of the bitmap from top to bottom, print a line where you print a character for every bit in that row
from left to right. Print an uppercase `X' for set bits and a period `.' for unset bits. Output a blank line
after each bitmap.

1
2 1
EENNWNENWWWSSSES.
Bitmap #1
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
.XXX............................
X...X...........................
X..X............................
X...X...........................
.X..X...........................
..XX............................

推荐代码 查看1977 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$0 $ms] 范晋豪@信息与计算科学142 108886 2017-07-02 23:10:47
内存最少[$948 $KB] 范晋豪@信息与计算科学142 108886 2017-07-02 23:10:47
第一AC 范晋豪@信息与计算科学142 108886 2017-07-02 23:10:47
第一挑战 范晋豪@信息与计算科学142 108886 2017-07-02 23:10:47

赛题来源/所属竞赛 20100831湖工大校赛 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛