20分求助
查看原帖
20分求助
1388504
Ryan40420楼主2024/12/28 19:51

(https://www.luogu.com.cn/record/196422191) 用 setw()setw() 做的

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n; 
	for(int i=1;i<=n;i++){
		int p=1; 
		cout<<setw(3*(n-i)+1)<<p;
		for(int j=1;j<i;j++){
			p=p*(i-j)/j;
			cout<<setw(6)<<p;
		}
		cout<<endl;
	}
	return 0;
}

2024/12/28 19:51
加载中...