Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
339796 张子捷(太高) GESP:2023-6月等级2-T1-找素数 C++ Accepted 100 0 MS 272 KB 423 2025-01-05 14:55:12

Tests(5/5):


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


Judgement Protocol: