
https://cdn.luogu.com.cn/upload/image_hosting/ffraxr5p.png
#include <bits/stdc++.h>
using namespace std;
char a[2005][2005];
void dg(int x, int y, int n)
{
if (n = 1) a[x][y] = '+';
else
{
for (int i = 1; i <= n; i++)
a[x + i - 1][y + n / 2] = '|';
for (int j = 1; j <= n; j++)
a[x + n / 2][y + j - 1] = '-';
a[x + n / 2][y + n / 2] = '+';
dg(x, y, n / 2);
dg(x, y + n / 2 + 1, n / 2);
dg(x + n / 2 + 1, y, n / 2);
dg(x + n / 2 + 1, y + n / 2 + 1, n / 2);
}
}
int main()
{
int n;
cin >> n;
dg(1, 1, n);
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
cout << a[i][j];
cout << endl;
}
return 0;
}