่งฃๆณไธใ็ชฎ่
โ ๅฎๆดไปฃ็ขผ
่ฉๅ็ตๆ(ๅ่) ๏ผ AC (0.1s, 348KB)
#include <bits/stdc++.h>
using namespace std;
bool isPrime(int x)
{
if(x==1) return false;
if(x==2) return true;
if(x%2==0) return false;
for(int i=3; i<=sqrt(x); i+=2){
if(x%i==0) return false;
}
return true;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int a, b;
while(cin >> a >> b){
int n = 0;
for(int i=a; i<=b; i++){
if(isPrime(i)) n++;
}
cout << n << "\n";
}
return 0;
}