include[HTML_REMOVED]
using namespace std;
int main(){
int n,m,k=1;
cin>>n>>m;
int a[n][m];
int left=0,right=m-1,top=0,bottom=n-1;
while(left<=right && top<=bottom){
for(int i=left;i<=right;i)a[top][i]=k;
for(int i=top+1;i<=bottom;i)a[i][right]=k;
for(int i=right-1;i>=left&&top[HTML_REMOVED]=top+1&&left<right;i–)a[i][left]=k; //left<right同上,都是为了确保在while内部也保证不重叠
left;top;bottom–;right–;
}
for(int i=0;i<n;i){
for(int j=0;j<m;j++){
cout<<a[i][j]<<’ ‘;
}
cout<<endl;
}
return 0;
}