Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
72262 廖宸睿 校门外的树 C++ Compile Error 0 MS 0 KB 460 2024-05-04 15:35:57

Tests(0/0):


Code:

#include <iostream> #include <cstdio> using namespace std; int main() { int l,m,sum=0,q,z; cin>>l>>m; int a[l+1] for (int i=0;i<=l;i++) a[i]=1; for (int i=1;i<=m;i++){ cin>>q>>z; for(int j=q;j<=z;j++) a[j]=0; } for (int i=0;i<=l;i++){ if (a[i]==1) sum++; } cout<<sum; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:9:9: error: expected initializer before 'for'
         for (int i=0;i<=l;i++)
         ^
Main.cc:9:22: error: 'i' was not declared in this scope
         for (int i=0;i<=l;i++)
                      ^
Main.cc:14:13: error: 'a' was not declared in this scope
             a[j]=0;
             ^
Main.cc:17:17: error: 'a' was not declared in this scope
             if (a[i]==1)
                 ^