| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 146762 | 李明秦 | 打印貌似杨辉三角 | C++ | Accepted | 1 MS | 280 KB | 439 | 2026-01-30 15:59:35 |
#include<bits/stdc++.h> using namespace std; int main(){ int n,a[31][31]={0}; cin>>n; a[1][1]=1; for(int i=2;i<=n;i++){ for(int j=1;j<=n;j++){ if(j!=1&&i!=j)a[i][j]=a[i-1][j-1]+a[i-1][j]; else a[i][j]=i; } } 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; }