Page 1 of 2

10495 - Conic Distance

Posted: Tue May 27, 2003 12:39 am
by Tobbi
I solved it correctly for the sample cases just with simple geometry. However, I always get either TLE or WA.

So do I really need to do that heavy differential geometry stuff to solve that problem properly with a single equation!? :o

Posted: Tue May 27, 2003 2:55 am
by Nak
Basic high school math is enough.
If you get TLE, maybe you're not reading input correctly?

Posted: Tue May 27, 2003 6:36 am
by anupam
we have taken all acounts we know. but oh! what may be the problems getting wa.
is there any special input.(critical input)..
please let us know.
thanks.
--
anupam

Posted: Tue May 27, 2003 6:45 pm
by Tobbi
3 4 5 0 5 359.99
10 10 7.07 0 7.07 180

should give

0.00
12.67

Posted: Wed May 28, 2003 1:01 pm
by anupam
that is one of the best test cases, i think just testing now. thank u.
--
anupam

Posted: Wed May 28, 2003 2:12 pm
by Tobbi
Good luck!

Posted: Wed May 28, 2003 2:43 pm
by anupam
i think the problem may be soloved using polar coordinate system and thinking abt two dimension only.
do u agree?
may polar coordinate system solve the problem?
--
anupam

Posted: Wed May 28, 2003 8:13 pm
by Lars Hellsten
anupam wrote:i think the problem may be soloved using polar coordinate system and thinking abt two dimension only.
do u agree?
may polar coordinate system solve the problem?
--
anupam
Hint: think about how you might make a cone from a piece of paper. Then "unroll" the paper and see how the coordinates map.

Posted: Tue Dec 09, 2003 9:22 am
by Observer
Hi I'm a beginner in geometry, and I can't even understand the sample input... (so stupid)

Could anyone please explain to me why the output for "3.0 4.0 5.0 0.0 5.0 90.0" is 4.54 ? Why isn't it 1/4 * (2*3*pi) = 4.71?

Please help! Thanks in advance.

-------------
*** EDIT ***

Ignore my silly comments above. Got AC-ed already. :wink:

-------------

10495!!!!!!!

Posted: Sat Aug 28, 2004 10:07 am
by magic_guy
what would the angle |A1-A2| be if the cone is unrolled ? :-?

Posted: Sun Aug 29, 2004 10:11 am
by magic_guy
anyone may help with this problem? :cry:

Posted: Sun Aug 29, 2004 1:58 pm
by magic_guy
#include "string.h"
#include "math.h"
#include "stdio.h"


int main(int argc, char* argv[])
{
double r,h,d1, A1, d2, A2,c ,temp,res;
int i,j,k;
while(scanf("%lf%lf%lf%lf%lf%lf",&r,&h,&d1,&A1,&d2,&A2)!=EOF)
{
if(d1>d2)
{
temp=d1;
d1=d2;
d2=temp;
}
c=2*d1*d1*(1-cos(fabs(A2-A1)*2*acos(-1)*r/360/h));
res=(d2-d1)*(d2-d1)+c-2*(d2-d1)*sqrt(c)*cos((fabs(A2-A1)*2*acos(-1)*r/360/h+acos(-1))/2);
printf("%.2lf\n",sqrt(res));
}
return 0;
}



MY CODE.COULD ANYONE HELP ME!?THAAAAAAAAAAAAAANKS

facing problems..

Posted: Wed Feb 02, 2005 2:17 pm
by sohel
Hi,
I am having some trouble in dealing with this problem..

I shifted the two points so that their angles lie between 0 and 180 and then unfolded the cone(iykwim).
Then I tried to find the cartesian coordinates of the two points on the two dimentional axis and that is where I got stuck.

btw: do you get a semicircle when you unfold a cone? :-?

Some hints might get me started on this one.

.. and thanks.

Posted: Sun Jul 24, 2005 12:05 am
by daveon
Hi sohel,

When you unfold a cone, you get a circular sector that is slightly larger than a semicircle.

To get the angle of the circular sector, just use this;
area lateral surface of cone = area of circular sector
R=slant_height
area lateral surface of cone = PIE*r*slant_height
area of circular sector = 0.5*R*R*theta

I'm sure you can take it from here by using this value of theta.

And also, try this test case:

INPUT

Code: Select all


6.0 8.0 2.14 75.2 9.58 114.3
6.0 8.0 2.14 320.9 9.58 0

OUTPUT

Code: Select all


7.66
7.66

Regards.

Posted: Sun Jul 24, 2005 1:18 am
by daveon
First of all, change

#include "string.h"
#include "math.h"
#include "stdio.h"

to

#include <string.h>
#include <math.h>
#include <stdio.h>

Also, try this test case:

INPUT

Code: Select all


6.0 8.0 2.14 75.2 9.58 114.3
6.0 8.0 2.14 320.9 9.58 0

OUTPUT

Code: Select all


7.66
7.66