Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
139778 黄枳润 打印貌似杨辉三角 C++ Compile Error 0 MS 0 KB 690 2025-12-08 19:20:09

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,a[40][40]={0}; for(int i=0;i<40);i++){ for(int j=0;j<40;j++){ a[i][j]=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:9:21: error: expected ';' before ')' token
     for(int i=0;i<40);i++){
                     ^
Main.cc:9:23: error: 'i' was not declared in this scope
     for(int i=0;i<40);i++){
                       ^