Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
28703 朱王睿 打印貌似杨辉三角 C++ Accepted 4 MS 740 KB 343 2022-06-25 16:54:48

Tests(10/10):


Code:

#include<iostream> #include<cstring> #include<cstdio> using namespace std; int main(){ int n; cin>>n; long long a[31][31]; for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ if(j==1||i==j){ a[i][j]=i; }else{ a[i][j]=a[i-1][j-1]+a[i-1][j]; } cout<<a[i][j]<<" "; } cout<<endl; } return 0; }