帮我康康
查看原帖
帮我康康
1627685
hello_fool楼主2025/1/16 18:29
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,a[25][25]={1};
    cin>>n;
    for(int i=1;i!=n;i++){
    	for(int j=0;j<=i;j++){
    		a[i][j]=a[i-1][j]+a[i-1][j-1];
		}
	}
	for(int i=0;i!=n;i++){
		for(int j=0;j<=i;j++){
			cout<<a[i][j];
			if(j!=i-1){
				cout<<" ";
			}
		}
		if(i!=n-1){
			cout<<endl;
		}
	}
	return 0;
}
2025/1/16 18:29
加载中...