Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
32282 徐若宸 素数个数 C++ Wrong Answer 0 MS 256 KB 258 2023-11-27 20:51:53

Tests(0/1):


#include <bits/stdc++.h> using namespace std; bool maxn(int n){ if(n==1||n==0)return 0; for(int i=2;i*i<n;i++){ if(n%i==0)return 0; } return 1; } int main(){ int a,b=0; cin>>a; for(int i=2;i<=a;i++){ if(maxn(i)) b++; } cout<<b; }


Judgement Protocol: