1377 问题 G: Border

时间限制: 1s 内存限制: 32MB 提交: 7 解决: 4
题目描述
You are to write a program that draws a border around a closed path into a bitmap, as displayed in the
following figure:
Border
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............................
提示

零基础的同学可以先学习基础,教程见:  C语言教程C++教程编译器教程数据结构教程Python教程单片机教程

视频教学见视频网课

比赛公告

题号:1371,1372,1373,1374,1375,1376,1377,1378,1379,1380

点击上方导航栏的训练,点击题库,寻找题号即可找到对应题目,比赛结束后,请通过训练->题库->寻找对应题目的方式做题

因为不确定因素太多,就不再安排大家轮流讲题了,大家做不出题可以在测试结束后去题库找对应的题目看题解,希望大家自觉练习,认真练习,考核测试会采取不同与现在测试的方式,两个月后综合测试成绩不达标者会退出实验室,希望大家认真对待