Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
155768 陈骏睿 素数检测 C++ Compile Error 0 MS 0 KB 504 2026-06-13 12:02:51

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; const long long n=3000000; int main(){ bool a[3000001]={0}; for(int 1=2;i<=sqrt(n);i++){ if(a[i])continue; for(int j=i*i;j<=n;j+=i){ a[j]=1; } } for(int i=2;i<=n;i++){ if(!a[i])cout<<i<<" "; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:10:11: error: expected unqualified-id before numeric constant
   for(int 1=2;i<=sqrt(n);i++){
           ^
Main.cc:10:11: error: expected ';' before numeric constant
Main.cc:10:12: error: lvalue required as left operand of assignment
   for(int 1=2;i<=sqrt(n);i++){
            ^
Main.cc:10:15: error: 'i' was not declared in this scope
   for(int 1=2;i<=sqrt(n);i++){
               ^
Main.cc:10:25: error: expected ')' before ';' token
   for(int 1=2;i<=sqrt(n);i++){
                         ^
Main.cc:10:26: error: 'i' was not declared in this scope
   for(int 1=2;i<=sqrt(n);i++){
                          ^