杭电2012,VC上是通过的,提交后却是WA,菜鸟请教~~
#include "stdio.h"#include<math.h>
void main()
{
double x,y,i,j,n,m;
while(scanf("%lf%lf",&x,&y)!=EOF)
{
if(x==0&&y==0)
break;
for(n=x;n<=y;n++)
{
m=n*n+n+41;
for(i=2,j=0;i<=sqrt(m);i++)
{
if(int(m)%int(i)==0)
{j++;}
}
}
if(j==0)
printf("OK\n");
else
printf("Sorry\n");
}
}
菜鸟请教~~~