-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcf36b.cpp
More file actions
37 lines (32 loc) · 687 Bytes
/
cf36b.cpp
File metadata and controls
37 lines (32 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <cstdio>
#include <cstring>
const int MAX_N = 5;
int n, m;
char maz[MAX_N][MAX_N];
char ans[MAX_N*100][MAX_N*100];
void dfs(int r, int c, char ch, int f) {
if (f == 0) ans[r][c] = ch;
else {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
dfs(r * n + i, c * n + j, (ch == '*' ? '*' : maz[i][j]), f - 1);
}
}
}
}
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
scanf("%d%d", &n, &m);
for (int i = 0; i < n; ++i) {
scanf("%s", maz[i]);
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
dfs(i, j, maz[i][j], m - 1);
}
}
for (int i = 0; ans[i][0]; ++i)
puts(ans[i]);
return 0;
}