Start 2024-01-26 14:30:00

冬令营基础班1.26数组

End 2024-01-26 17:30:00
Contest is over.
Now 2025-04-20 07:50:21

e

include<bits/stdc++.h> using namespace std; int main() {

int n,a[20][20]={0}; cin>>n; for(int i=1;i<=n;i++) { a[i][1]=1; a[i][i]=1; } for(int i=3;i<=n;i++) for(int j=2;j<=i-1;j++)

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]<<(j==i?'\n':' ');

return 0; }


liuyinuo  •  1年前

The contest has ended.