10495 - Conic Distance

All about problems in Volume 104. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Tobbi
New poster
Posts: 17
Joined: Sat Jan 25, 2003 3:06 pm
Location: Europe

10495 - Conic Distance

Post 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
Nak
New poster
Posts: 14
Joined: Sat Oct 26, 2002 5:59 am
Location: Sweden

Post by Nak »

Basic high school math is enough.
If you get TLE, maybe you're not reading input correctly?
anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post 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
"Everything should be made simple, but not always simpler"
Tobbi
New poster
Posts: 17
Joined: Sat Jan 25, 2003 3:06 pm
Location: Europe

Post by Tobbi »

3 4 5 0 5 359.99
10 10 7.07 0 7.07 180

should give

0.00
12.67
anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post by anupam »

that is one of the best test cases, i think just testing now. thank u.
--
anupam
"Everything should be made simple, but not always simpler"
Tobbi
New poster
Posts: 17
Joined: Sat Jan 25, 2003 3:06 pm
Location: Europe

Post by Tobbi »

Good luck!
anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post 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
"Everything should be made simple, but not always simpler"
Lars Hellsten
New poster
Posts: 20
Joined: Thu Apr 10, 2003 10:53 pm

Post 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.
Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Post 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:

-------------
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
magic_guy
New poster
Posts: 10
Joined: Sat Aug 28, 2004 8:18 am

10495!!!!!!!

Post by magic_guy »

what would the angle |A1-A2| be if the cone is unrolled ? :-?
magic_guy
New poster
Posts: 10
Joined: Sat Aug 28, 2004 8:18 am

Post by magic_guy »

anyone may help with this problem? :cry:
magic_guy
New poster
Posts: 10
Joined: Sat Aug 28, 2004 8:18 am

Post 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
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

facing problems..

Post 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.
daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Location: TORONTO, CANADA

Post 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.
daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Location: TORONTO, CANADA

Post 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

Post Reply

Return to “Volume 104 (10400-10499)”