Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
126359 | 蔡书涵 | 判断素数II | C++ | Accepted | 17 MS | 272 KB | 342 | 2025-07-17 17:55:14 |
#include<bits/stdc++.h> using namespace std; bool zhi(int n){ for(int i=2;i<n;i++){ if(n%i==0){ return false; } } return true; } int main(){ int n,s=0; cin>>n; for(int i=2;i<=n;i++){ if(zhi(i)==true){ s++; } } cout<<s; return 0; }