Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
72257 廖宸睿 19灯的编号 C++ Compile Error 0 MS 0 KB 478 2024-05-04 15:24:26

Tests(0/0):


Code:

#include <iostream> #include <cstdio> using namespace std; int main() { int m,n,a[5001]={0},max,x; cin>>n>>m; for (int i=2;i<n;i++){ for (int j=i;j<=n;j++){ if (j%i==0) a[j]=!a[j]; } } int b=0; for (int i=1;i<=n;i++){ if (a[i]==0&&b==0) cout<<i; b=1; } else if (a[i]==0) cout<<','<<i; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:20:9: error: 'else' without a previous 'if'
         else if (a[i]==0)
         ^
Main.cc:20:20: error: 'i' was not declared in this scope
         else if (a[i]==0)
                    ^
Main.cc:6:29: warning: unused variable 'max' [-Wunused-variable]
         int m,n,a[5001]={0},max,x;
                             ^
Main.cc:6:33: warning: unused variable 'x' [-Wunused-variable]
         int m,n,a[5001]={0},max,x;
                                 ^