Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
159641 张晓冉 判断素数II C++ Compile Error 0 MS 0 KB 396 2026-09-05 19:36:39

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; bool p(int c){ for(int i = 2;i*i <= x;i++){ if(x % i == 0){ return false; } return true; } } int m(int n){ int s = 0; for(int i = 2;i <= n;i++){ if(p(i)){ s++; } } return s; } int main(){ int n; cin>>n; cout<<m(n)<<endl; return 0; }


Run Info:

Main.cc: In function 'bool p(int)':
Main.cc:4:26: error: 'x' was not declared in this scope
     for(int i = 2;i*i <= x;i++){
                          ^