#include <iostream>
using namespace std;
int main()
{
int A[100][100],n;
cin>>n;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
if(i==j || i+j==n+1) A[i][j]=0;
else if(i<j && i+j<n+1)//nord
{
if(j<n/2+1) A[i][j]=1;
else if(j>n/2+1) A[i][j]=2;
else A[i][j]=0;
}
else if(i>j && i+j>n+1)//sud
{
if(j<n/2+1) A[i][j]=6;
else if(j>n/2+1) A[i][j]=5;
else A[i][j]=0;
}
else if(i<j && i+j>n+1)//est
{
if(i<n/2+1) A[i][j]=3;
else if(i>n/2+1) A[i][j]=4;
else A[i][j]=0;
}
else if(i>j && i+j<n+1)//vest
{
if(i<n/2+1) A[i][j]=8;
else if(i>n/2+1) A[i][j]=7;
else A[i][j]=0;
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
cout<<A[i][j]<<" ";
cout<<endl;
}
return 0;
}
|