样例都对,但就是(WA),帮帮吧
查看原帖
样例都对,但就是(WA),帮帮吧
561009
KangYiWang楼主2021/8/28 20:13
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,z = 1;
	cin>>n;
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= n;j++){
			if(z < 10){
				cout<<0<<z;
				z++;
			}
			else{
				cout<<z;
				z++;
			}
		}
		cout<<endl;
	}
	z = 1;
	for(int i = 1;i <= n;i++){
		for(int k = 0;k < n - i;k++){
			cout<<"  ";
		}
		for(int j = 1;j <= i;j++){
			
			if(z < 10){
				cout<<0<<z;
				z++;
			}
			else{
				cout<<z;
				z++;
			}
		}
		cout<<endl;
	}
	return 0;
}
2021/8/28 20:13
加载中...