i read the posts in here. but couldn't figure out what is wrong. i got WA for more than 10 times.

i am considering that all the point coordinates has 7 digits after the decimal point ( as the problem statement says)

can anyone point out my mistake?

thanks...

Code: Select all

```
int n,a;
void process()
{
int i,j;
int cnt=0;
char xx[30],yy[30];
unsigned long long px,py,radius,c1x,c1y,c2x,c2y,c3x,c3y,c4x,c4y,d1,d2,d3,d4,first,last;
radius = a * 10000000;
c1x = 0;
c1y = 0;
c2x = radius;
c2y = 0;
c3x = radius;
c3y = radius;
c4x = 0;
c4y = radius;
for(i=0;i<n;i++)
{
px = py = 0;
scanf("%s%s",xx,yy);
for(j=0;xx[j];j++)
{
if(isdigit(xx[j]))
px = px*10+(xx[j]-'0');
}
for(j=0;yy[j];j++)
{
if(isdigit(yy[j]))
py = py*10+(yy[j]-'0');
}
d1 = (px - c1x)*(px - c1x) + (py - c1y)*(py - c1y);
d2 = (px - c2x)*(px - c2x) + (py - c2y)*(py - c2y);
d3 = (px - c3x)*(px - c3x) + (py - c3y)*(py - c3y);
d4 = (px - c4x)*(px - c4x) + (py - c4y)*(py - c4y);
if(d1<=radius * radius && d2<=radius * radius && d3<= radius * radius && d4<=radius * radius)
cnt++;
}
first = cnt * a * a / n;
last = cnt * a * a % n;
printf("%llu.%llu",first,last);
int digcnt=1;
while(last>=10)
{
digcnt++;
last/=10;
}
for(i=0;i<5-digcnt;i++)
putchar('0');
printf("\n");
}
int main(void)
{
freopen("in.in","r",stdin);
// freopen("out.txt","w",stdout);
int cases=1;
while(scanf("%d%d",&n,&a)==2)
{
if(n==0)
break;
process();
}
return 0;
}
```