fork download
  1. #include <iostream>
  2.  
  3. int main() {
  4. auto f = [](int n){for(int x = 0; x < n; ++x){for(int y = 0; y < n; ++y)std::cout << std::min(x+1 < y+1 ? x+1 : y+1,n-x < n-y ? n-x : n-y);std::cout<<std::endl;}};
  5. f(5);
  6. return 0;
  7. }
  8.  
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
11111
12221
12321
12221
11111