第4讲1*
#include <iostream>
using namespace std;
int main()
{
int n;
while(cin >> n,n)
{
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= n; j++)
{
int up = i, down = n-i+1, left = j, right = n-j+1;
cout << min(min(up,down),min(left,right)) << ' ';
}
cout <<endl;
}
cout <<endl;
}
return 0;
}
//一圈一圈的,每一圈到对应的边的距离+1即为打印的矩阵
//一个数到上边距离为i,到左边为j,到下边为n-i+1,到右边是n-j+1