Run ID:129017

提交时间:2025-08-21 15:28:39

#include<bits/stdc++.h> using namespace std; int main() { int n, a[40][40] = {0}; a[1][1] = 1; cin >> n; for(int i = 2; i <= n; i++) { for(int j = 1; j <= i; j++) { a[i][j] = a[i - 1][j - 1] + a[i - 1][j]; } } for(int i = 1; i <= n; i++) { for(int j = 1; j <= i; j++) { if(i == j) { cout << a[i][j] << endl; } else { cout << a[i][j] << " "; } } } return 0; }