# Three way communications

I submitted a result for the three way communications problem and I checked for the sample input given on ideone.com,it gives the correct result however it gives a wrong answer notice when I submitted it,I used cin and cout and even after changing that too scanf and printf it gives wrong answer please help.
Here is the code I used.
#include
int main()
{

``````int nCase,nMaxr,dummy;
long x1,x2,x3,y1,y2,y3,dist1,dist2,dist3,k,ans[101]={0};
scanf("%d",&nCase);
dummy=nCase;
while(nCase>0)
{
scanf("%d",&nMaxr);
k=nMaxr*nMaxr;
scanf("%ld",&x1);
scanf("%ld",&y1);
scanf("%ld",&x2);
scanf("%ld",&y2);
scanf("%ld",&x3);
scanf("%ld",&y3);
dist1=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
dist2=(x1-x3)*(x1-x3)+(y1-y3)*(y1-y3);
dist3=(x2-x3)*(x2-x3)+(y2-y3)*(y2-y3);
if(((dist1<=k)&&(dist2<=k))||((dist2<=k)&&(dist3<=k))||((dist1<=k)&&(dist3<=k)))
{
ans[nCase]=1;
}
nCase--;
}
for(int i=dummy;i>0;i--)
{
if(ans[i]==1)
{
printf("Yes \n");
}
else
{
printf("No \n");
}
}
``````

}

SINCE main() IS int RETURN TYPE THEN WHERE IS YOUR return STATEMENT?

tried that still gives wrong answer

@shikhs123 There is at least this one problem, you are printing "Yes ", when you are asked to print “yes” -> wrong answer. Read the FAQ please - http://www.codechef.com/wiki/faq#How_does_Codechef_test_whether_my_solution_is_correct_or_not

@betlista I will be forever grateful to you

#include<stdio.h>
#include<math.h>
int main()
{
float a,b,c,d,e,f,q,w,r;
float p;
int oo;
printf(“enter number of cases:\n”);
scanf("%d",&oo);

for(int l=0;l<oo;l++)
{

``````printf("\nenter range\n");
scanf("%d",&p);
scanf("%d %d",&a,&b);
printf("\n");
scanf("%d %d",&c,&d);
printf("\n");
scanf("%d %d",&e,&f);
q=sqrt((a-c)*(a-c)+(b-d)*(b-d));
w=sqrt((a-e)*(a-e)+(b-f)*(b-f));
r=sqrt((c-e)*(c-e)+(d-f)*(d-f));
if(((p<=(w)) && (p<=(q))) || ((p<=(w)) && (p<=(r))) ||  ((p<=(r)) && (p<=(q))))
printf("\n\nno\n\n");
else
printf("\nyes\n");
``````

}
}

//