题目描述
给定区间[L,R] (L≤R≤2147483647,R-L≤1000000),请计算区间中素数的个数。
输入格式
两个数L和R。
输出格式
一行,区间中素数的个数。
输入输出样例
输入 #1
2 11
输出 #1
5
此题有一个坑。
若一个数是INT_MAX,看起来用int是可以的。但若是把这个数+1了呢?
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 10;
int flag[maxn];
int prim[maxn];
int ansArr[maxn