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

建议使用的浏览器:

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

3144:Gokigen Naname

题目描述
Gokigen Naname is a Japanese puzzle game played on a square grid in which numbers in circles appear at some of the intersections on the grid.

The objective is to draw diagonal lines in each cell of the grid, such that the number in each circle equals the number of lines extending from that circle. Additionally, it is forbidden for the diagonal lines to form an enclosed loop.

    

The first figure shows the start position of a puzzle. The second figure shows the solution to the same puzzle. A Gokigen Naname puzzle always has exactly one solution.
输入解释
The first line of the input contains a single integer n (2 <= n <= 7), the number of cells along each of the sides in the square grid. Then follow n + 1 lines containing the contents of the intersections of the grid cells. Each such line will contain a string of n+1 characters, either a digit between 0 and 4, inclusive, or a period ('.') indicating that there is no number at this intersection (arbitrarily many lines may connect to it).
输出解释
The output should contain n lines, each line containing exactly n characters. Each character should either be a slash or a backslash, denoting how the corresponding grid cell is filled.
输入样例
3
1.1.
...0
.3..
..2.
5
.21...
..33.0
......
..33..
0..33.
....11
输出样例
\//
\\\
/\/
/\\//
//\\\
\\\//
\/\\/
///\\
来自杭电HDUOJ的附加信息
Recommend chenrui

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

题目来源 NCPC 2009

源链接: HDU-3144

最后修改于 2020-10-25T23:00:32+00:00 由爬虫自动更新

共提交 0

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