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

建议使用的浏览器:

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

1888:Rectangular Polygons

题目描述
In this problem, we will help the Faculty of Civil Engineering. They need a software to analyze ground plans of buildings. Specifically, your task is to detect outlines of a building when all of its corners are given.



You may assume that each building is a rectangular polygon with each of its sides being parallel either with X or Y axis. Therefore, each of its vertex angles is exactly either 90 or 270 degrees.
输入解释
The input contains several buildings. The description of each building starts with a single positive integer N , the number of corners (polygon vertices), 1 ≤ N ≤ 1000. Then there are N pairs of integer numbers Xi , Yi giving coordinates of individual corners, |Xi|, |Yi| ≤ 10 000.

You may assume that all corners are listed and no two of them have the same coordinates. The polygon does always exist, it is closed, its sides do not intersect or touch (except neighboring sides, of course), and it contains no “holes” inside. In other words, the outline is formed by one closed line. The order of corners in the input file may be arbitrary.

There is an empty line after each building, then the next one is described. After the last building,there is a single zero that signals the end of input.
输出解释
For each building, output one line containing N characters without any whitespace between them. The characters should be uppercase letters that specify directions of individual walls (sides) when the building outline is followed. “N” stands for North (the positive direction of the Y axis), “E” for East (the positive direction of the X axis), “W” for West, and “S” for South. The “walk” should start in the vertex that has been given first in the input and always proceed in the clockwise direction.
输入样例
4
0 0
2 2 
0 2
2 0

6
1 1
2 2
0 1
1 0
0 2
2 0

0
输出样例
NESW
WNESWN

提示
The second sample  input corresponds  to the picture. 
来自杭电HDUOJ的附加信息
Recommend linle

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

源链接: HDU-1888

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

共提交 0

通过率 --%
时间上限 内存上限
3000/1000MS(Java/Others) 32768/32768K(Java/Others)