确定是1e8了啊,怎么还会CE呢???
#include<iostream>
#include<vector>
const int maxn = (int)1e8;
int p[maxn];
bool np[maxn] = {true};
long long ri(){
static char c;
static long long k;
static bool s;
k = 0, s = false, c = '\0';
while (c < '0' || c > '9') if ((c = getchar()) =='-') s = true;
while (c >= '0' && c <= '9'){
k = (k << 3) + (k << 1) + (c - '0');
c = getchar();
}
return s?-k:k;
}
void calcP(){
int num, k = 0;
for (num=2;num<maxn;num++){
if (!np[num]) p[k++] = num;
for (int i=0;i<k;i++){
np[num*k] = true;
if (num%k == 0) break;
}
}
}
int main(){
calcP();
int n, q;
std::cin >> n >> q;
while (q--){
std::cout << p[ri()] << std::endl;
}
}