Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
129072 林嘉乐 打印杨辉三角 C++ Compile Error 0 MS 0 KB 355 2025-08-21 17:09:09

Tests(0/0):


Code:

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


Run Info:

Main.cc: In function 'int main()':
Main.cc:20:3: error: expected ';' before '}' token
   }
   ^