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

建议使用的浏览器:

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

3561:Pseudographical recognizer

题目描述

Let us define a pseudographical image to be a rectangular matrix of the characters ’.’, ’‑’, ’|’, ’\’, and ’/’.

The character ’.’ denotes empty space on the image. A horizontal line segment is given as a set of ’-’ characters in adjacent cells in the same row of the matrix. A vertical line segment is given as a set of ’|’ characters in adjacent cells in the same column of the matrix. Similarly, a diagonal line segment is given as a set of ’/’ or ’\’ characters in adjacent cells in the same diagonal of the matrix. Of course, a line segment going from Northwest to Southeast has to be given using the ’\’ characters and a line segment going from Southwest to Northeast using the ’/’ characters.

Write a program that, given a pseudographical image, determines if it contains exactly one line segment – horizontal, vertical, or diagonal.

输入解释
The input contains several test cases. The first line contains the number of test cases T (1 ≤ T ≤ 100). Next follow the descriptions of each test case. The first line of the test case description contains two integers N and M (1 ≤ N, M ≤ 10), the number of rows and columns of the matrix, respectively. Each of the following N lines of the description contains exactly M symbols ‘.’, ‘‑’, ‘|’, ‘\’, or ‘/’.
输出解释

The output consists of T lines, one line per each test case. This line should contain the word CORRECT if the input image contains exactly one line segment, or the word INCORRECT otherwise.

输入样例
5
5 5
.....
\....
.\...
..\..
.....
3 3
/..
./.
../
3 6
.|....
.|.---
.|....
3 3
...
...
...
1 1
/
输出样例
CORRECT
INCORRECT
INCORRECT
INCORRECT
CORRECT

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3561

最后修改于 2020-10-29T07:04:35+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536