#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e7+10;
const int INF = 0x3fffffff;
int t,n;
bool checked[MAXN];
bool yes[MAXN],fuyi[MAXN];
int nex[MAXN];
inline void biao(int x){
int s=1;
while(x < MAXN){
fuyi[x*(s++)]=true;
}
}
inline bool panduan(int x){
while(x>0){
if((x%10)==7) return true;
x/=10;
}
return false;
}
inline void check(){
int pre = 0;
for(int i = 1;i < MAXN;i++){
if(fuyi[i]) continue;
if(panduan(i)){
biao(i);
continue;
}
nex[pre]=i;
pre=i;
}
}
int main(){
check();
scanf("%d",&t);
for(int i = 0;i < t;i++){
scanf("%d",&n);
if(fuyi[n]){
printf("%d",-1);
continue;
}
printf("%d",nex[n]);
}
return 0;
}
我不理解这个代码直接给我来了个
Process exited after 0.6424 seconds with return value 3221225477
然后洛谷提交直接全RE 求助哪位神犇帮我这个蒟蒻看看,万分感激