Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
65051 | 游四鑫 | 打印杨辉三角 | C++ | Accepted | 2 MS | 380 KB | 625 | 2024-01-23 17:26:44 |
#include<iostream> using namespace std; int a[1000][1000]; int main(){ int n,m; cin>>n; for(int i=0;i<n;i++){ for(int j=0;j<=i;j++){ if(i==j||j==0){ a[i][j]=1; } else{ a[i][j]=a[i-1][j-1]+a[i-1][j]; } } } for(int i=0;i<n;i++){ for(int j=0;j<=i;j++){ cout<<a[i][j]<<' '; } cout<<endl; } return 0; }