| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 149447 | Kevin | 打印杨辉三角 | C++ | Accepted | 1 MS | 280 KB | 370 | 2026-03-13 15:02:22 |
#include<bits/stdc++.h> using namespace std; int a[50][50]; int main() { int n; cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ if(j==1||i==j){ a[i][j]=1; } else{ 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++) { cout<<a[i][j]<<" "; } cout<<endl; } return 0; }