Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
6719 | 邓小龙 | 数字方阵 | C++ | Accepted | 0 MS | 256 KB | 819 | 2025-03-14 16:24:56 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int n,a[10][10]; void s1(){ for(int k=1;k<=n;k++){//层号 for(int i=k;i<=n-k+1;i++){//第k层的行,开始行号,结束行号 for(int j=k;j<=n-k+1;j++){//第k层的列,开始的列号,结束的列号 a[i][j]=k; //cout<<a[i][j]<<" "; } //cout<<endl; } //cout<<"------"<<endl; } } int main(){ cin>>n; s1(); for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++) cout<<a[i][j]<<" "; cout<<endl; } return 0; }