<=
by irris @ 2022-05-11 13:50:29
暴力当然不行
by ACPC @ 2022-07-29 17:51:40
```
#include<bits/stdc++.h>
using namespace std;
bool zs(int x)
{
if(x<=1)return true;
for(int i=2;i*i<=x;i++)
{
if(x%i==0)return false;
}
return true;
}int n,m,a[99999999]={0},x,y;
int main()
{
cin>>n>>m;
a[0]=0;
a[1]=0;
a[2]=1;
a[3]=2;
int w=3;
for(int i=4;i<=m;i++)
{
if(zs(i))
{
a[i]=a[w]+1;
w=i;
}
else
{
a[i]=a[i-1];
}
}
for(int i=1;i<=n;i++)
{
cin>>x>>y;
if(x>=1&&x<=m&&y>=1&&y<=m)
{
int S=max(x,y);
int s=min(x,y);
cout<<a[S]-a[s-1]<<endl;
}
else
{
cout<<"Crossing the line"<<endl;
}
}
return 0;
}
```
by Poole_tea @ 2022-08-06 17:15:54