我吐了
查看原帖
我吐了
184463
iamdayan楼主2020/11/7 19:46
#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	//正方形 
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(4*i+j+1<10){
				cout << "0"<<(4*i+j+1);
			}
			else{
				cout << (4*i+j+1);
			}
		}
			cout << endl; 
	} 
	cout << endl;
	//三角形
	int m=1;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n-i;j++){//空格 
			cout << "  ";
		}
		for(int j=1;j<=i;j++){//数字 
			if(m<10){
				cout << "0" <<m;
				m++;
			}
			else{
				cout << m;
				m++;
			}
		}
		if(i < n){
			cout << endl; 
		} 
		
	} 
	return 0;
}
2020/11/7 19:46
加载中...