Tên đăng nhập Điểm ▾ Bài tập Giới thiệu
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0

include <bits/stdc++.h>

include <vector>

include <cstring>

using namespace std;
int N=1000000,d=0;;
bool snt[1000005];
int a[80000];
void sang(){
memset(snt,true,N+4);
snt[0]=snt[1]=false;
for(int i = 2; ii <= N; ++i) {
if(snt[i] == true) {
for(int j =i
i; j <= N; j += i){
snt[j] = false;
}
}
}
for(int i=2;i<=N;i++){
if(snt[i]==true){
d++;a[d]=i;
}
}
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
sang();
int li,ri;
int q;cin>>q;
while(q--){
cin>>li>>ri;
int *l=lower_bound(a,a+d,li);
int *r=upper_bound(a,a+d,ri);
cout<<r-l<<endl;
}
return 0;
}

31401 0 0
31401 0 0

đẹp trai

31401
PY2GNgoTranGiaBao
Ngô Trần Gia Bảo
0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0

THPT Le Quy Don - Binh Phuoc

31401 0 0

dinosaur

31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401
PY2DNguyenNgocKhaiMy
Nguyễn Ngọc Khải My
0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401 0 0
31401
tk22PhamMinhDung
Phạm Minh Dũng
0 0