| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 131529 | 李朋秦 | 判断素数II | C++ | Wrong Answer | 1 MS | 264 KB | 311 | 2025-09-27 15:01:28 |
#include<bits/stdc++.h> using namespace std; bool sum(int x){ if(x==2){ return true; }else{ 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; }
------Input------
302
------Answer-----
62
------Your output-----
151