秒 了 直 接
2024-07-30 20:48:21
发布于:上海
5阅读
0回复
0点赞
#include<iostream>
#define fastcio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define INF 0x3f3f3f3f;
#define MAXN (20+5)
using namespace std;
typedef long long ll;
ll YH_tri[MAXN][MAXN];
void ff_assignment(ll FLV_i,ll FLV_j){
if(FLV_j==1 or FLV_j==FLV_i){
YH_tri[FLV_i][FLV_j]=1;
}
else{
YH_tri[FLV_i][FLV_j]=YH_tri[FLV_i-1][FLV_j]+YH_tri[FLV_i-1][FLV_j-1];
}
}
int main(void){
fastcio
ll n;
cin>>n;
for(ll FLV_i=1;FLV_i<=n;FLV_i++){
for(ll FLV_j=1;FLV_j<=FLV_i;FLV_j++){
ff_assignment(FLV_i,FLV_j);
}
}
for(ll FLV_i=1;FLV_i<=n;FLV_i++){
for(ll FLV_j=1;FLV_j<=FLV_i;FLV_j++){
cout<<YH_tri[FLV_i][FLV_j]<<" ";
}
cout<<"\n";
}
return 0;
}
这里空空如也
有帮助,赞一个