use std::io::{stdin, Read, StdinLock}; use std::str::FromStr; use std::iter::FromIterator; fn main() { let cin = stdin(); let mut scan = Scanner::new(cin.lock()); let n = scan.read::(); let k = scan.read::(); let q = n / (k * k); let rem = n % (k * k); let mut p = 0; { let mut i = 1; while p < rem { p += i * i; i += 1; } } let rest_sz = (p as f64).sqrt() as usize; let w = q * k + rest_sz; let mut ret = vec![vec!['.';w];w]; for i in 0..q { set_sq(&mut ret, i * k, k, k * k); } set_sq(&mut ret, q * k, rest_sz, rem); for y in 0..w { println!("{}", ret[y].iter().cloned().collect::()); } } fn set_sq(ret: &mut Vec>, prefix: usize, size: usize, mut cnt: usize) { for y in prefix..prefix + size { for x in prefix..prefix + size { if cnt == 0 {return;} ret[y][x] = '#'; cnt -= 1; } } } // region template #[allow(dead_code)] fn iu(i: i64) -> usize { i as usize } #[allow(dead_code)] fn ui(i: usize) -> i64 { i as i64 } #[allow(dead_code, deprecated)] fn join(slice: &[T], sep: &str) -> String { let strings = slice.iter().map(|t| format!("{}", t)).collect::>(); strings.connect(sep) } #[allow(dead_code)] fn arr<'a, S, T>(n: usize, mut f: S) -> Vec where S: FnMut(usize) -> T + 'a { (0..n).map(|i| f(i)).collect::>() } #[allow(dead_code)] fn alt(v: Vec) -> T where T: FromIterator { v.into_iter().collect::() } #[allow(dead_code)] fn dup(v: &[S]) -> T where T: FromIterator, S: Clone { v.iter().cloned().collect::() } struct Scanner<'a> { cin: StdinLock<'a>, } #[allow(dead_code)] impl<'a> Scanner<'a> { fn new(cin: StdinLock<'a>) -> Scanner<'a> { Scanner { cin: cin } } fn read1(&mut self) -> Option { let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect::(); token.parse::().ok() } fn read(&mut self) -> T { self.read1().unwrap() } fn readn(&mut self, n: usize) -> Vec { (0..n).map(|_| self.read::()).collect() } fn chars(&mut self) -> Vec { self.read::().chars().collect() } } // endregion