69,371
社区成员
发帖
与我相关
我的任务
分享
#include<stdio.h>
#include<math.h>
int main()
{
int a, b, i, t, j, x;
bool c = true;
while (scanf("%d%d", &a, &b) != EOF)
{
if (a == 0 && b == 0)
break;
if (a > b)
{
t = a;
a = b;
b = t;
}
for (i = a; i <= b; i++)
{
x = i * i + i + 41;
for (j = 2; j <= int(sqrt(x)); j++)
{
if (x % j == 0)
{
c = false;
printf("Sorry\n");
break;
}
}
}
if (c == true)
printf("OK\n");
}
return 0;
}