📄 2202.cpp
字号:
/* This Code is Submitted by wywcgs for Problem 2202 on 2006-04-10 at 20:18:55 */
#include <cstdio>
#include <algorithm>
using namespace std;
const int BM = 128;
const int DIR[][2] = { { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 } };
int w, h;
char font[BM][BM];
inline bool star(int x, int y) { return x >= 0 && x < h && y >= 0 && y < w && font[x][y] == '*'; }
int main()
{
int t, T, i, j, k;
scanf("%d", &T);
for(t = 0; t < T; t++) {
if(t != 0) printf("---\n");
scanf("%d %d\n", &w, &h);
for(i = 0; i < h; i++) gets(font[i]);
for(i = -1; i <= h; i++) {
for(j = -1; j <= w; j++) {
char prt = '.';
if(star(i, j)) prt = '*';
for(k = 0; k < 4; k++)
if(star(i+DIR[k][0], j+DIR[k][1])) prt = '*';
putchar(prt);
}
putchar('\n');
}
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -