这天chengdong在检测贪玩蓝月的时候,到了一个副本,副本介绍:“找到魔王一刀999级,橙装随便爆,金币捡捡检。。。”。但是chengdong发现里面的迷宫太简单了,魔王一下子就被发现了!chengdong反馈了这个问题后,贪玩蓝月就让chengdong来写一个代码,代码要求对随机给的一个n*m的迷宫,和一个k,要添加k堵墙;由此来增加游戏难度;但是chengdong觉得烦,就把这个任务交给了你,而且还根据他自己的美学对你提出了一个要求:你要让剩下的部分只有一个连通区域(设定是只能上下左右走);
The first line contains three integers n, m, k (1 ≤ n, m ≤ 500, 0 ≤ k < s), where n and m are the maze's height and width, correspondingly, k is the number of walls Pavel wants to add and letter s represents the number of empty cells in the original maze.
Each of the next n lines contains m characters. They describe the original maze. If a character on a line equals ".", then the corresponding cell is empty and if the character equals "#", then the cell is a wall.
第一行输入三个整数n, m, k;(1<=n,m<=500, k<s, s是“.”的数量)
接下来n行,每行m个字符(“#”是墙, “.”是路);
Print n lines containing m characters each: the new maze that fits Pavel's requirements. Mark the empty cells that you transformed into walls as "X", the other cells must be left without changes (that is, "." and "#").
It is guaranteed that a solution exists. If there are multiple solutions you can output any of them.
输出也是一个n*m的迷宫,在这个迷宫里,要有k个“X”,表示这里将添加一堵墙。
保证有解,有多种方案时,随便输出一种。
3 4 2
#..#
..#.
#...
#.X#
X.#.
#...
5 4 5
#...
#.#.
.#..
...#
.#.#
#XXX
#X#.
X#..
...#
.#.#