Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
132935 李馥甄 判断素数II C++ Accepted 16 MS 276 KB 329 2025-10-12 17:14:43

Tests(10/10):


Code:

#include <bits/stdc++.h> using namespace std; int n; bool zhishu(int k){ if(k<2){ return false; } for(int i=2;i<=k-1;i++){ if(k%i==0){ return false; } } return true; } int main(){ cin>>n; int cnt=0; for(int i=1;i<=n;i++){ if(zhishu(i)==true){ cnt++; } } cout<<cnt; return 0; }