题解
2025-03-21 20:55:56
发布于:江苏
0阅读
0回复
0点赞
#include<iostream>
using namespace std;
int n,h[25][25];
int main(){
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
if(j==1){
h[i][j]=1;
cout<<h[i][j]<<" ";
continue;
}
if(j==i){
h[i][j]=1;
cout<<h[i][j]<<" ";
continue;
}
h[i][j]=h[i-1][j]+h[i-1][j-1];
cout<<h[i][j]<<" ";
}
cout<<endl;
}
}
这里空空如也
有帮助,赞一个