local mfl, mce = math.floor, math.ceil local n, k = io.read("*n", "*n") local size = mce(n / k) print(size) local tn = n local offset = 1 for i = 1, size do for j = 1, size do if (size + j - offset) % size < k then if 0 < tn then io.write("#") tn = tn - 1 else io.write(".") end else io.write(".") end end io.write("\n") offset = offset + k if size <= offset then offset = offset - size end end