10011 - Where Can You Hide?
Moderator: Board moderators
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
10011 - Where Can You Hide?
I'm always getting Wrong Answer and don't know the reason. I calculate the distance from the house to both of the tangents of the tree. If the house lies between the tangents, I output the smaller value for the distance. In other cases I print 0.000. I have also tested my program with the special case r=0 (I print 0.000). Please help me.
-
- A great helper
- Posts: 284
- Joined: Thu Feb 28, 2002 2:00 am
- Location: Germany
- Contact:
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
-
- A great helper
- Posts: 284
- Joined: Thu Feb 28, 2002 2:00 am
- Location: Germany
- Contact:
Problem #10011: Where Can You Hide?
Although the problem is extremely sketchy on this (IMO), not only must you not be able to walk outside of the tree shade within the distance you give, you must not be able to walk into the tree (at least that was what I did in order to get AC).
Thus: 5 5 5 11 5
has an output of: 1.000
Thus: 5 5 5 11 5
has an output of: 1.000
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
-
- Problemsetter
- Posts: 22
- Joined: Tue Jun 11, 2002 12:35 am
My program ( AC ) output ...Adrian Kuegel wrote:Thanks for your reply. I have inserted the code for these cases, but I still get wrong answer.
Can someone tell me the output for:
4
5 5 5 0.1 6.42
5 5 5 0.1 5.998
5 5 5 0.0005 10
20 -24 6 25 -30
My program prints:
0.100
0.001
0.000
1.810
0.100
0.001
0.001
1.810
and the problem says that output the "furthest" distance..
and then sample gives the "nearest" distance ...

10011 - where can you hide? - rounding problems?
hi!
i've solved that problem, but it's really strange. i got a short solution without trigonometric functions. only '*', '/' and sqrt. but if i just store some values (as distance from origin to treecenter) in a variable, instead of recalculating every time it's used, i get WA.
i can't even think of a cause for this behaviour. (or what does the compiler optimize there)
is there a problemsetter, to whom i could send the code?
ciao
-justus
ps: it's not much increase in speed, but i really like to understand what's happening
i've solved that problem, but it's really strange. i got a short solution without trigonometric functions. only '*', '/' and sqrt. but if i just store some values (as distance from origin to treecenter) in a variable, instead of recalculating every time it's used, i get WA.
i can't even think of a cause for this behaviour. (or what does the compiler optimize there)
is there a problemsetter, to whom i could send the code?
ciao
-justus
ps: it's not much increase in speed, but i really like to understand what's happening
solved
ok i found out, what the problem was.
in my first version the compiler let the values in the fpu registers (so with 80bits) in the other version i stored the values in doubles and so lost the precision. if i use long doubles i get AC for this version to.
so everybody might try to use long doubles for this problem.
ciao
-justus
in my first version the compiler let the values in the fpu registers (so with 80bits) in the other version i stored the values in doubles and so lost the precision. if i use long doubles i get AC for this version to.
so everybody might try to use long doubles for this problem.
ciao
-justus
-
- New poster
- Posts: 9
- Joined: Sat Jun 29, 2002 10:59 am
- Location: china
- Contact:
-
- New poster
- Posts: 9
- Joined: Sat Jun 29, 2002 10:59 am
- Location: china
- Contact:
its the max length you can go from your house in a straight line without hitting the radiation no matter which direction you choose. -> min of your distanceswenzhi cai wrote:what is the meaning of maximum safe travel distance?
if the distance from origin to right tangent is smaller than the distance
from origin to left,which should I output?
-justus
-
- New poster
- Posts: 9
- Joined: Sat Jun 29, 2002 10:59 am
- Location: china
- Contact: