编辑器加载

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int sushu(int a)
{
    int c=0;
     if(a==0||a==1)
     {
         return 1;
     }
     else
     {
         for(int i=2;i<=sqrt(a);i++)
         {
              if(a%i==0)
              {
                  c++;
                  break;
              }
         }
         if(c==1)
            return 0;
         else
             return 1;
     }
} 
int main()
{
    int x,y;
    while(scanf("%d%d",&x,&y),x||y)
    {
        int c=0;
        for(int i=x;i<=y;i++)
        {
            if(sushu(i*i+i+41))
               c++;
            else 
               break;
        }
        if(c==y-x+1)
           printf("OK\n");
        else
           printf("Sorry\n");
    }
   // system("pause");
    return 0;
}

中...

posted on 2011-07-16 14:46  枫叶飘泪  阅读(321)  评论(0编辑  收藏  举报