Run ID:161282
提交时间:2026-10-03 14:40:27
#include<bits/stdc++.h> using namespace std; long long a[31][31]; int main(){ int n; cin>>n; a[1][1]=1; for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ if(j==1 || i==1){ a[i][j]=1; } else{ a[i][j]=a[i-1][j]+a[i-1][j-1]; } } } for(int i=1;i<=n;i++){ for (int j=1;j<=i;j++){ cout<<a[i][j]<<" "; } cout<<endl; } return 0; }