你看,当你i=2的时候 j=1的时候,应该要输出05了,但是你 i*j 却输出了个02 所以错了
by shikexin @ 2023-11-22 09:04:30
```
#include<iostream>
#include<cstdio>
using namespace std;
int main() {
int n;
int t=1;
cin>>n;
for(int j=1; j<=n*n; j++) {
int g=j;
if(g/10==0) {
cout<<"0";
}
cout<<g;
if(j%n==0) cout<<endl;
}
cout<<endl;
for(int i=1; i<=n; i++) {
for(int g=n-i; g>=1; g--) {
cout<<" "<<" ";
}
for(int j=1; j<=i; j++) {
if(t/10==0) {
cout<<"0";
}
cout<<t;
t++;
}
cout<<endl;
}
return 0;
}
```
拿走不谢
by 805912cpy @ 2023-12-17 15:43:55
cc
by zyl_tsingbei @ 2024-01-24 18:14:15