#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n; // 读入方阵的大小
int a[n][n]; // 创建二维数组
// 填充方阵
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
a[i][j] = 1; // 默认所有元素为1
// 设置中心点和四条对角线上的元素为0
if (i == n / 2 && j == n / 2 ||
i + j == n / 2 ||
i - j == n / 2 ||
j - i == n / 2 ||
i + j == (n / 2 - 1 + n)) {
a[i][j] = 0;
}
}
}
// 输出方阵
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << setw(3) << a[i][j]; // 设置场宽为3,输出数组元素
}
cout << endl; // 输出换行
}
return 0;
}
/**************************************************************
Problem: 1327
User: zhenghaoxuan
Language: C++
Result: Accepted
Time:8 ms
Memory:2072 kb
****************************************************************/