- 【Level 1 语法基础课】检验赛1
杨辉三角
- 2024-1-13 15:00:27 @
···#include <bits/stdc++.h> using namespace std; int main() { int a[114][114]; int n,i,j; cin>>n; for(i=1;i<=n;i++) { for(j=1;j<=i;j++) { if(ij||j1) a[i][j]=1; else a[i][j]=a[i-1][j]+a[i-1][j-1]; cout<<a[i][j]<<" "; } cout<<endl; } return 0; }
0 comments
No comments so far...