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.
10210 - Romeo and Juliet !
Moderator: Board moderators
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
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
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
i wonder if the formula is correct(i assure u i am pretty good at math though, no bragging really).
i will be greatful...
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 toRad(float);
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));
m=((1.0/tan(toRad(ang_CMD)))+(1.0/tan(toRad(ang_ENF))))*x;
printf("%.3f\n",m);
}
return 0;
}
float toRad(float a)
{
return ((a/180.000000)*PI);
}
float absolute(float x)
{
if(x<0)return (-x);
return x;
}
[/cpp]
i will be greatful...
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.
B.D:if you want to see my code reply again i send it.
Re: 10210 - Romeo & Juliet !
Please say why i amng wrong answer? My code below.please.
please some body reply.
Code: Select all
code removed after accepted
-
- 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 ![:P](./images/smilies/icon_razz.gif)
![:P](./images/smilies/icon_razz.gif)
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?
-
- 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!