| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 146761 | 李朋秦 | 打印貌似杨辉三角 | C++ | Accepted | 1 MS | 276 KB | 482 | 2026-01-30 15:56:31 |
#include<bits/stdc++.h> #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<=i;j++){ if((j!=1)&&(j!=i))a[i][j]=a[i-1][j]+a[i-1][j-1]; 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; }