16 条题解

  • 0
    @ 2023-7-11 10:55:41

    #include <stdio.h> #include using namespace std; const int N = 10+ 10; const int INF = 0x3f3f3f3f; int n, a[N][N],x,y,num; int main(){ cin >>n; x=1,y=1;//起点位置 while(num<n*n) { //向下填数 while(x<=n) a[x++][y]=++num; //回正轨 x=1,y++; } for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { cout <<a[i][j]<<" "; } cout<<endl; }

    return 0;
    

    }

    信息

    ID
    1042
    时间
    1000ms
    内存
    32MiB
    难度
    6
    标签
    递交数
    964
    已通过
    301
    上传者