#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using i64 = int64_t; using i32 = int32_t; char a[1001][1001]; int main() { int n, k; cin >> n >> k; int p = n / (k * k), q = n % (k * k); int r = 0; while (r * r < q) ++r; for (int i = 0; i < k * p + r; ++i) { for (int j = 0; j < k * p + r; ++j) { a[i][j] = '.'; } } for (int b = 0; b < p; ++b) { for (int i = k * b; i < k * (b + 1); ++i) { for (int j = k * b; j < k * (b + 1); ++j) { a[i][j] = '#'; } } } int c = 0; for (int i = k * p; i < k * p + r; ++i) { for (int j = k * p; j < k * p + r; ++j) { ++c; if (c <= q) a[i][j] = '#'; } } for (int i = 0; i < k * p + r; ++i) { cout << a[i] << '\n'; } return 0; }