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

建议使用的浏览器:

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

3546:Sea battle

题目描述

Mr. X is writing “Sea Battle” computer game. Now he needs a program that checks if the initial position of ships that a human player creates is correct.

The field for the game is a matrix of size 10x10. The human player has to put 10 ships on the field. Each ship occupies from 1 to 4 cells of the field and has sizes 1xK or Kx1, where K is between 1 and 4. The human player has to put into the field: one 4-cell ship, two 3-cell ships, three 2-cell ships and four 1-cell ships. None of the two of the ships can touch each other even by diagonal. Neither can a ship touch the border of the field. In other words, it is prohibited to occupy cells in the first/last row/column of the field.

Your task is to check if the matrix is a correct initial position of ships for the “Sea Battle” game.

输入解释

The input contains 10 lines containing 10 characters each. The character is either ’1’ or ’.’. ’1’ means that the cell is occupied by a ship, ’.’ means that the cell is free.

输出解释

The output has to contain a word ’correct’ or ’incorrect’.

输入样例
1.........
....11.11.
.11.......
.11.1.1.1.
....1.1.1.
....1.1...
..........
.1..1.....
..1...1...
..........
输出样例
incorrect

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

源链接: POJ-3546

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

共提交 0

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