Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
118688 刘佳宇 寻找绝对素数 C++ Compile Error 0 MS 0 KB 740 2025-05-10 10:01:58

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; bool s=0; int sushu(int n,int m){ for(int i=n;i<=m;i++){ for(int j=2;j<i;j++){ if(i%j==0){ s=0; return s; } else{ s=1; return s; } } } } int main(){ int a,b; for(int i=a;i<=b;i++){ if(sushu(s)==1&&i!=a){ cout<<","<<i; } else{ cout<<i; } } } #include<bits/stdc++.h> using namespace std; bool s=0; int sushu(int n,int m){ for(int i=n;i<=m;i++){ for(int j=2;j<i;j++){ if(i%j==0){ s=0; return s; } else{ s=1; return s; } } } } int main(){ int a,b; for(int i=a;i<=b;i++){ if(sushu(s)==1&&i!=a){ cout<<","<<i; } else{ cout<<i; } } }


Run Info:

Main.cc:30:3: error: stray '#' in program
 } #include
   ^
Main.cc: In function 'int main()':
Main.cc:22:13: error: too few arguments to function 'int sushu(int, int)'
   if(sushu(s)==1&&i!=a){
             ^
Main.cc:4:5: note: declared here
 int sushu(int n,int m){
     ^
Main.cc: At global scope:
Main.cc:30:4: error: 'include' does not name a type
 } #include
    ^
Main.cc:32:6: error: redefinition of 'bool s'
 bool s=0;
      ^
Main.cc:3:6: note: 'bool s' previously defined here
 bool s=0;
      ^
Main.cc: In function 'int sushu(int, int)':
Main.cc:33:5: error: redefinition of 'int sushu(int, int)'
 int sushu(int n,int m){
     ^
Main.cc:4:5: note: 'int sushu(int, int)' previously defined here
 int sushu(int n,int m){
     ^
Main.cc: In function 'int main()':
Main.cc:48:5: error: redefinition of 'int main()'
 int main(){
     ^
Main.cc:19:5: note: 'int main()' previously defined here
 int main(){
     ^
Main.cc:51:13: error: too few arguments to function 'int sushu(int, int)'
   if(sushu(s)==1&&i!=a){
             ^
Main.cc:4:5: note: declared here
 int sushu(int n,int m){
     ^
Main.cc: In function 'int sushu(int, int)':
Main.cc:17:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
Main.cc: In function 'int sushu(int, int)':
Main.cc:46:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^