很水的题, 注意闭区间
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
#define ms(x, n) memset(x,n,sizeof(x));
typedef long long LL;
const LL maxn = 1e9;
bool isPrime(int n)
{
if(n == 1 ) return false;
for(int i = 2; i <= sqrt(n); i++)
if(n%i == 0)
return false;
return true;
}
int main()
{
int x, y;
while(cin >> x >> y && (x!=0||y!=0)){
bool flag = 1;
for(int i = x; i <= y; i++)
if(!isPrime(i*i+i+41)){
flag = 0;
break;
}
if(!flag) cout << "Sorry" << endl;
else cout << "OK" << endl;
}
return 0;
}