Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
76578 sh25_shenpy 素数个数 C++ 通过 0 MS 196 KB 293 2025-12-19 15:30:47

Tests(1/1):


#include <cstdio> int n, cnt; bool prime[50010]; int main() { scanf("%d", &n); for(int i = 2;i <= n; i++) { if(prime[i]) continue; for(int j = 2 * i; j <= n; j += i) prime[j] = true; } for(int i = 2; i <= n; i++) if(!prime[i]) cnt++; printf("%d", cnt); return 0; }


测评信息: