大佬求助
查看原帖
大佬求助
741120
_O__o_楼主2022/8/25 13:37

我正方形对了,三角形不知道错那```

#include<bits/stdc++.h>

using namespace std;

int main() {
	int x=1,y,z,n;
	cin >> n;
	
	for(int i=1;i<=n;i++){
		for(int u=1;u<=n;u++,x++){
			if(x <10){
				cout <<0;
			}
			cout << x;
			if(x%n == 0){
				cout << endl;
			}
		}
	} 
	cout << endl;

	int hh=0;
	for(int i=1;i <= n;i++){
		for(int u=1;u<=2*(n-i);u++){
			cout <<' ';
		}
		for(int h =1;h<=1;h++){
			hh++;
			if(hh < 10){
				cout << 0;
			}
			cout << hh;
		}
		cout << endl;

	}
	return 0;

}

2022/8/25 13:37
加载中...