Pro.ID22220 TitleDensity Center Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22220 AC3 Submit20 Ratio15.00% 时间&空间限制描述A peg board is drilled with a square matrix of holes, into which pegs might be inserted. The dimension of a peg board is the number of holes in a row or column, and is always a positive power of 2; i.e. 2n for some n ≥ 0. The density of a peg board is the number of holes containing pegs. The density center of a peg board is a hole coordinate on the board defined recursively:
Write a program that inputs a peg board and finds its density center. 输入The first line of input contains the dimension of the peg board, which is 2n for some n ≥ 0. The remaining 2n lines represent the peg board, with each line containing 2n characters. A blank character represents an empty hole and a non-blank character (e.g. o) represents a hole containing a peg. 输出Description A peg board is drilled with a square matrix of holes, into which pegs might be inserted. The dimension of a peg board is the number of holes in a row or column, and is always a positive power of 2; i.e. 2n for some n ≥ 0. The density of a peg board is the number of holes containing pegs. The density center of a peg board is a hole coordinate on the board defined recursively:
Write a program that inputs a peg board and finds its density center. Input The first line of input contains the dimension of the peg board, which is 2n for some n ≥ 0. The remaining 2n lines represent the peg board, with each line containing 2n characters. A blank character represents an empty hole and a non-blank character (e.g. o) represents a hole containing a peg. Output Output the peg board as it appears in the input, except the coordinate of the density center, which should be marked with the character X. Sample Input 16 Sample Output o oo o o 样例输入16 样例输出 o oo o o 提示作者 |