Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
130047 周荣浩 判断素数II C++ Accepted 19 MS 276 KB 299 2025-09-07 14:27:17

Tests(10/10):


Code:

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