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