Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
131532 李朋秦 判断素数II C++ Accepted 2 MS 268 KB 270 2025-09-27 15:03:07

Tests(10/10):


Code:

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