#include using namespace std; typedef long long ll; typedef pair pii; typedef pair pll; #define LLINF 9223372036854775807 #define MOD ll(1e9+7) #define all(x) (x).begin(),(x).end() #define dbg(x) cerr<<#x<<": "<> n >> k; ll m = 0; ll black = 0; while(n > black){ for(int i = 1; i <= k; i++){ m++; black += i*i-(i-1)*(i-1); if(n <= black){ break; } } } cout << m << endl; ll cnt = 0; for(int i = 0; i < m; i++){ for(int j = 0; j < m; j++){ if(i/k*k <= j && j < i/k*k+k && cnt < n){ cout << "#"; cnt++; }else{ cout << "."; } } cout << endl; } return 0; }