Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
164827 杜禹轩 素数对 C++ Compile Error 0 MS 0 KB 398 2026-11-07 15:29:07

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; bool q(int s){ if(s==1){ return 0; } for(int i=2;i<=sqrt(s);i++){ if(s%i==0){ return 0; } } return 1; } int main(){ long long n,m=0; cin>>n; for(int i=2;i<=n-2;i++){ if(q(i)&&q(i+2)){ cout<<i<<" "<<i+2<<endl; f=1; } } if(f!=1){ cout<<"No"; }else{ return 0; } } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:22:4: error: 'f' was not declared in this scope
    f=1;
    ^
Main.cc:25:6: error: 'f' was not declared in this scope
   if(f!=1){
      ^
Main.cc:17:14: warning: unused variable 'm' [-Wunused-variable]
  long long n,m=0;
              ^
Main.cc: At global scope:
Main.cc:32:2: error: expected unqualified-id before 'return'
  return 0;
  ^
Main.cc:33:1: error: expected declaration before '}' token
 }
 ^