1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int n,m,i,j,t,x,y; 6 while(~scanf("%d%d",&x,&y)&&(x||y)) 7 { 8 for(i=x,t=1; i<=y; ++i) 9 { 10 x=i*i+i+41; 11 n=(int)sqrt((double)x); 12 for(j=2; j<=n; ++j) 13 { 14 if(!(x%j)) 15 break; 16 } 17 if(j<=n) 18 t=0; 19 } 20 if(t) 21 printf("OK\n"); 22 else 23 printf("Sorry\n"); 24 } 25 return 0; 26 }
时间: 2024-10-16 22:22:48