求助!急急急!
查看原帖
求助!急急急!
1052016
xietianbo楼主2024/5/10 20:45

大佬帮忙检查一下
就对了第四个测试点

#include<iostream>
using namespace std;
int main(){
    int n,tot=0;
    cin>>n;
    for(int i=1;tot<n*n;i++){
        for(int j=1;j<=n;j++){
            tot++;
            if(tot<10)  cout<<0;
            cout<<tot;
        }
        cout<<endl;
    }
    cout<<endl;
    tot=1;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n-i;j++) cout<<" ";
        for(int j=n-i+1;j<=n;j++){
            if(tot<10)  cout<<0;
            cout<<tot;
            tot++;
        }
        cout<<endl;
    }
    return 0;
}
2024/5/10 20:45
加载中...