Vile Grasshoppers
题意:给你p和y,让你在(p,y]找一个最大的数,这个数不能被[2,p]中的数整除
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 10000000
using namespace std;
typedef long long ll;
const int MAXN=1e9+10;
const int MAX=1e5+10;
const double eps=1e-6;
int main(){
#ifdef ONLINE_JUDGE
#else
freopen("in.txt","r",stdin);
#endif
int p,y;
cin>>p>>y;
while(y>p){
int juge=1;
for(int i=2;i*i<=y&&i<=p;i++){
if(y%i==0){
juge=0;
break;
}
}
if(juge){
cout<<y<<endl;
return 0;
}
y--;
}
cout<<-1<<endl;
return 0;
}