AT_abc482_b.Blank Bingo
入门
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There is a 5×5 grid, and some of the cells are marked.
The current state of the grid is given by strings S1,S2,S3,S4,S5 of length 5 consisting of o and ..
The cell at the i-th row from the top and the j-th column from the left is marked if the j-th character of Si is o, and unmarked if it is ..
Find the minimum number of additional marks needed to achieve a bingo.
Here, achieving a bingo means that there exist 5 cells lined up in a single vertical, horizontal, or diagonal line, all of which are marked.
有一个 5×5 的网格,其中部分格子已被标记。
当前网格的状态由长度为 5 的字符串 S1,S2,S3,S4,S5 给出,每个字符串仅由字符 o 和 . 组成。
对于从上往下数第 i 行、从左往右数第 j 列的格子,若 Si 的第 j 个字符为 o,则该格子已被标记;若为 .,则未被标记。
求达成宾果(bingo)所需的最少额外标记数。
此处,“达成宾果”指存在一条由 5 个格子组成的直线(竖直、水平或对角线方向),且该直线上的所有格子均已被标记。
输入格式
The input is given from Standard Input in the following format:
S1
S2
S3
S4
S5
输入从标准输入中按以下格式给出:
S1
S2
S3
S4
S5
输出格式
Print the answer.
输出答案。
输入输出样例
输入#1
.o..o ..oo. .o..o o.o.. o..oo
输出#1
2
输入#2
o..oo ...o. o.ooo oo.o. .o.oo
输出#2
0
输入#3
o..o. .o... ..o.o ..o.. o...o
输出#3
1
说明/提示
Sample 1 Explanation:
For example, you can achieve a bingo by marking the 2 cells in the 5-th row from the top and the 2-nd and 3-rd columns from the left.
Sample 2 Explanation:
If a bingo is already achieved, no additional marks are needed, so the answer is 0.
Constraints
- Each of S1,S2,S3,S4,S5 is a string of length 5 consisting of
oand..
样例 1 解释:
例如,你可以通过标记从上往下数第 5 行、从左往右数第 2 列和第 3 列的 2 个格子来达成宾果(bingo)。
样例 2 解释:
如果宾果(bingo)已经达成,则无需再标记任何格子,因此答案为 0。
限制条件
- S1,S2,S3,S4,S5 中每个字符串长度均为 5,且仅由字符
o和.组成。
输入解题思路,AI测评打分。不知道怎么写?