样例
解析:就是相当于找该位置到上下左右边界的最短距离
···
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
while(true){
int n=sc.nextInt();
if(n==0)break;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
int x=Math.min(i+1,n-i);
int y=Math.min(j+1,n-j);
int z=Math.min(x,y);
System.out.printf("%d ",z);
}
System.out.println();
}
System.out.println();
}
}
}
```
标签:Scanner,int,System,sc,打卡,public
From: https://www.cnblogs.com/gyg1222/p/17372135.html