求助
查看原帖
求助
661600
stopIntferingThePoll楼主2022/6/11 13:39

求助!20pts

#include<bits/stdc++.h>
using namespace std;

int main(){
    long long ans[100][100];
    long long n;
    cin>>n;
    ans[0][0]=1;
    for(int p=0;p<n;p++){
    	ans[p][p]=1;
    	ans[p][0]=1;
    	for(int j=0;j<p;j++){
    		ans[p][j]=ans[p-1][j-1]+ans[p-1][j];
		}
	}
	for(int y=0;y<n;y++){
		for(int h=0;h<=y;h++){
			cout<<ans[y][h]<<" ";
		}
		cout<<endl;
	}
	return 0;
} 
2022/6/11 13:39
加载中...