P1865 A % B Problem

#include
using namespace std;
const int MAXN=1000002;
int judge[MAXN]={};
int sum[MAXN]={};
int main()
{
	freopen("in.txt","r",stdin);
	int n,m;cin>>n>>m;
	judge[1]=1;sum[1]=0;
	for(int i=2;i<=m;i++){
		for(int j=2;j*i<=m;j++){
			judge[j*i]=1;//j*i毫无疑问都是非质数,有点像打表
		}
		if(judge[i]==0) sum[i]=sum[i-1]+1;
		else sum[i]=sum[i-1];//区间质数数组构造
	}
	for(int i=1;i<=n;i++){
		int a,b;cin>>a>>b;
		if(a<1||b<1||a>m||b>m)
		cout<<"Crossing the line"<

 

你可能感兴趣的:(C++/PAT/洛谷OJ)