| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 146694 | 李朋秦 | 打印杨辉三角 | C++ | Accepted | 1 MS | 276 KB | 413 | 2026-01-29 16:53:40 |
#include<bits/stdc++.h> using namespace std; int main() { int n,a[32][32]={0}; cin>>n; a[1][1]=1; for(int i=2;i<=n;i++){ for(int j=1;j<=n;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<=n;j++){ if(a[i][j+1]!=0){ cout<<a[i][j]<<" "; }else{ cout<<a[i][j]; break; } } cout<<endl; } return 0; }