Please, what's wrong with this code? Can it be precision errors?
[cpp]
#include <stdio.h>
#define NP 1002
#define dx(a,b) (a)-(b)
#define R(a,b) (a)*(a)+(b)*(b)
#define cango_(r) ((r)<=(l2)?1:0)
#define cango(a,b) cango_(R(dx((a)[0],(b)[0]),dx((a)[1],(b)[1])))
double l2;
int main(int argc, char* argv[])
{
#ifndef ONLINE_JUDGE
close (0); open ("myprog.in", O_RDONLY);
close (1); open ("myprog.out", O_WRONLY | O_CREAT, 0600);
#endif
double ps[2],pt[2],point[NP][2],v,t;//,r,pw[2],l2
register int i,j,k,len;
int go[NP],goe[NP];
bool exit,eend;
char a[101];
while (gets(a)) {
sscanf(a,"%lf %lf",&v,&t);
if(!v && !t) break;
l2 = v*t*60.0000000; l2 = l2*l2;
gets(a);
sscanf(a,"%lf %lf",&ps[0],&ps[1]);
gets(a);
sscanf(a,"%lf %lf",&pt[0],&pt[1]);
exit = false;
eend = false;
if(cango(ps,pt)){
exit = true;
printf("Yes, visiting 0 other holes.\n");
}
len = 0;
while ( gets( a ) && sscanf( a, "%lf %lf",&point[len][0],&point[len][1] ) == 2 ) {
if (exit){
continue;
}
go[len] = cango(ps,point[len]);
goe[len] = cango(pt,point[len]);
if(goe[len] && go[len]){
exit = true;
printf("Yes, visiting 1 other holes.\n");
}
len++;
if(eend) break;
}
if (exit) continue;
len--;
exit = false;
k = 0; i = -1;
while(++i<=len && k < len){
if(go
<= k ){
if(i == len){
i =-1;
k++;
}
continue;
}
for(j = 0;j<=len;j++){
if (go[j]) continue;
if(cango(point,point[j])){
go[j] = go+1;
if(goe[j]){
exit = true;
printf("Yes, visiting %d other holes.\n",go[j]);
break;
}
}
}
if(exit) break;
if(i == len){
i =-1;
k++;
}
}
if(!exit)
printf("No.\n");
}
return 0;
}
[/cpp]