Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char a[1000][1000];
- int main()
- {
- int n, m;
- char d;
- bool b;
- string s;
- cin >> n >> m;
- for (int i = 0; i < n; i++)
- for (int j = 0; j < m; j++)
- cin >> d, a[i * 2][j * 2] = d;
- for(int i = 0; i < 2 * n; i += 2)
- for(int j = 0; j < 2 * m; j += 2)
- if (a[i][j] == '#')
- {
- a[i][j + 1] = ((a[i][j + 2] == '#') ? '-' : ' ');
- a[i + 1][j] = ((a[i + 2][j] == '#') ? '|' : ' ');
- if (a[i + 2][j + 2] == '#') a[i + 1][j + 1] = (a[i + 1][j + 1] && a[i + 1][j + 1] != '\\' ? 'X' : '\\');
- if (i && a[i - 2][j + 2] == '#') a[i - 1][j + 1] = (a[i - 1][j + 1] && a[i - 1][j + 1] != '/'? 'X' : '/');
- if (j && a[i + 2][j - 2] == '#') a[i + 1][j - 1] = (a[i + 1][j - 1] && a[i + 1][j - 1] != '/' ? 'X' : '/');
- if (i && j && a[i - 2][j - 2] == '#') a[i - 1][j - 1] = (a[i - 1][j - 1] && a[i - 1][j - 1] != '\\' ? 'X' : '\\');
- }
- for (int i = 0; i < 2 * n; i++)
- {
- b = 0;
- s = "";
- for (int j = 0; j < 2 * m; j++)
- s += (a[i][j] ? a[i][j] : ' '), b = b || (a[i][j] && a[i][j] != ' ');
- if (b)
- {
- for (; s[s.size() - 1] == ' ' || !s[s.size() - 1]; s.resize(s.size() - 1));
- cout << s << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement