| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 364985 | 徐梓豪 | 【C4-10】输出杨辉三角的前N行 | C++ | 通过 | 100 | 2 MS | 252 KB | 363 | 2025-11-30 16:33:00 |
#include<bits/stdc++.h> using namespace std; int a[30][30],n,s; int main(){ cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ cin>>a[i][j]; if(j==1||i==j){ 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; }