## 10210 - Romeo and Juliet !

Moderator: Board moderators

skinnyguy
New poster
Posts: 17
Joined: Fri Oct 22, 2004 3:41 pm

### 10210 - Romeo and Juliet !

Can someone please give me sample inputs so i can try to figure out where the problem lies. my program works for the 2 sample inputs provided, but i dont know how to figure out if it is correct.
Thanks.

Rocky
Experienced poster
Posts: 124
Joined: Thu Oct 14, 2004 9:05 am
Contact:

### i give some input & output of 10210 try now.

input:
25 25 30 30 50 55
54 80 82 45 60 70
20 30 45 67 65 79
100 200 30 400 45 50
90 80 70 100 56 89

output :
code:
10.885
42.192
29.503
389.698
19.572

skinnyguy
New poster
Posts: 17
Joined: Fri Oct 22, 2004 3:41 pm
thanks for the inputs
my code gives correct responses for these inputs too...
but the online judge says wrong answers again an again
i am quite a newbie and am sometimes confused how to handle inputs and outputs for these problems.
plz tell me what's wrong with it

Code: Select all

``````[cpp]
#include<stdio.h>
#include<math.h>
#define PI 3.1415926
float absolute(float);
int main(/*int,char***/)
{
float x1,y1,x2,y2,ang_CMD,ang_ENF,x,m;
while(scanf("%f %f %f %f %f %f\n",&x1,&y1,&x2,&y2,&ang_CMD,&ang_ENF)>0)
{
x=sqrt(pow(absolute(x1-x2),2)+pow(absolute(y1-y2),2));
printf("%.3f\n",m);
}
return 0;
}
{
return ((a/180.000000)*PI);
}
float absolute(float x)
{
if(x<0)return (-x);
return x;
}
[/cpp]
``````
i wonder if the formula is correct(i assure u i am pretty good at math though, no bragging really).
i will be greatful...

Rocky
Experienced poster
Posts: 124
Joined: Thu Oct 14, 2004 9:05 am
Contact:
Well I Found Some Worng In you'r code.you make it complex but you can do it easily By the way i thing its wrong for POW FUNCTION & absoulet function.MULTIPLY (x1-x2)*(x1-x2) in this way you dont need to call absolulet function or pow.And DEFINE PI=2*acos(0.0) & use double data type.Thus your code become simple. BY.

B.D:if you want to see my code reply again i send it.

skinnyguy
New poster
Posts: 17
Joined: Fri Oct 22, 2004 3:41 pm
thanks a lot for the help...
i got accepted now.
i guess the problem indeed was fixed just by substituting the value of PI...
perhaps something to do with portability of code and difference in gcc/borland(i use borland though).
Thanks a lot again

Rocky
Experienced poster
Posts: 124
Joined: Thu Oct 14, 2004 9:05 am
Contact:
Well done for get accepted.BY

debugger
New poster
Posts: 8
Joined: Tue Jul 29, 2008 6:24 pm

### Re: 10210 - Romeo & Juliet !

Code: Select all

``````
code removed after accepted
``````

DD
Experienced poster
Posts: 145
Joined: Thu Aug 14, 2003 8:42 am
Location: Mountain View, California
Contact:

### Re: 10210 - Romeo & Juliet !

Originally, I thought that there may be some EPS problems. However, after I submitted and got A.C., I found this problem is really generous on precision
Have you ever...
• Wanted to work at best companies?
• Struggled with interview problems that could be solved in 15 minutes?
• Wished you could study real-world problems?
If so, you need to read Elements of Programming Interviews.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 10210 - Romeo & Juliet !

That is AC code
Check input and AC output for thousands of problems on uDebug!