Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
100745 | Kevin | 判断素数II | C++ | Accepted | 1 MS | 268 KB | 290 | 2024-12-12 14:46:14 |
#include<bits/stdc++.h> using namespace std; bool ss(int x){ int s=0; for(int i=2;i<=sqrt(x);i++){ if(x%i==0){ return false; } } return true; } int main(){ int n,sum=0; cin>>n; for(int i=2;i<=n;i++){ if(ss(i)){ sum++; } } cout<<sum; return 0; }