fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7.  
  8. int n, i, j;
  9. cin >> n;
  10. for (i = 1; i <= n; i++)
  11. {
  12. for (j = 1; j <= n; j++)
  13. {
  14. if (i == 1 || i == n || j == 1 || j == n || i == j || i + j - 1 == n || i <= j && i + j - 1 >= n)
  15. cout << "#";
  16. else
  17. cout << " ";
  18. }
  19. cout << endl;
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 4856KB
stdin
9
stdout
#########
##     ##
# #   ###
#  # ####
#   #####
#  # ####
# #   ###
##     ##
#########