CF1028A.Find Square

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Consider a table of size n×mn \times m, initially fully white. Rows are numbered 11 through nn from top to bottom, columns 11 through mm from left to right. Some square inside the table with odd side length was painted black. Find the center of this square.

考虑一个大小为 n×mn \times m 的表格,初始时全部为白色。行从上到下编号为 11 到 nn,列从左到右编号为 11 到 mm。表格内部某个边长为奇数的正方形区域被涂成黑色。请找出该正方形的中心。

输入格式

The first line contains two integers nn and mm (1≤n,m≤1151 \le n, m \le 115) — the number of rows and the number of columns in the table.

The ii-th of the next nn lines contains a string of mm characters si1si2…sims_{i1} s_{i2} \ldots s_{im} (sijs_{ij} is 'W' for white cells and 'B' for black cells), describing the ii-th row of the table.

第一行包含两个整数 nn 和 mm(1≤n,m≤1151 \le n, m \le 115),分别表示表格的行数和列数。

接下来的 nn 行中,第 ii 行包含一个长度为 mm 的字符串 si1si2…sims_{i1} s_{i2} \ldots s_{im}(其中 sijs_{ij} 为 'W' 表示白色格子,为 'B' 表示黑色格子),描述表格的第 ii 行。

输出格式

Output two integers rr and cc (1≤r≤n1 \le r \le n, 1≤c≤m1 \le c \le m) separated by a space — the row and column numbers of the center of the black square.

输出两个整数 rr 和 cc(1≤r≤n1 \le r \le n,1≤c≤m1 \le c \le m),以空格分隔——分别为黑色正方形中心所在的行号和列号。

输入输出样例

  • 输入#1

    5 6
    WWBBBW
    WWBBBW
    WWBBBW
    WWWWWW
    WWWWWW

    输出#1

    2 4
  • 输入#2

    3 3
    WWW
    BWW
    WWW

    输出#2

    2 1

输入解题思路,AI测评打分。不知道怎么写?

首页