Hard Question

A stone is dropped into a well. t seconds later, a splash is heard. The acceleration due to gravity is g metres per second per second, and the speed of sound is c metres per second. Calculate the depth of the well and the downwards velocity with which the stone hits the water.

Input Format

Line 1: The value of g (0 < g ≤ 1000)

Line 2: The value of c (0 < c ≤ 1000)

Line 3: The value of t (0 < t ≤ 1000)

Output Format

Line 1: The depth of the well in metres.

Line 2: The speed of the stone as it hits the water, in metres per second.

Sample Input


Sample Output


Your answers must have a relative or absolute error of less than 0.01.


The following equations may be useful:

  • $\Delta \vec{d} = \vec{v} \Delta t$
  • $\vec{v}_2 - \vec{v}_1 = \vec{a} \Delta t$
  • $\Delta \vec{d} = \frac{1}{2} (\vec{v}_1 + \vec{v}_2)
\Delta t$
  • $\Delta \vec{d} = \vec{v}_1 \Delta t +
\frac{1}{2} \vec{a}(\Delta t)^2$
  • $\Delta \vec{d} = \vec{v}_2 \Delta t -
\frac{1}{2} \vec{a}(\Delta t)^2$
  • $\|\vec{v}_2\|^2 - \|\vec{v}_1\|^2 =
2\vec{a}\cdot \Delta \vec{d}$

Here $\Delta t, \Delta \vec{d}, \vec{v}, \vec{v}_1, \vec{v}_2,
\vec{a}$ represent time, displacement, velocity, initial velocity, final velocity, and acceleration, respectively.

All Submissions
Best Solutions

Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Jan 16, 2009
Author: bbi5291

Problem Types: [Show]

Languages Allowed:

Comments (Search)

Looks like the judge was wrong...

yeah, its because of the rounding error, jargon manually most of the submissions, but its still not fixed yet

Actually, it has been fixed, so manual rejudging shouldn't be necessary now.

my physics seems right, but why am i getting WA? can you please tell me if its a formating error/round error of algorithm error, help me please, thank you!

rounding or algorithm error

1. Please make use of the edit function instead of posting multiple comments in a row. You can edit your comments by clicking the pencil icon on the left side of your comment.

2. Our sincerest apologies. This problem was effectively impossible for a while, due to an error on our end. I have resolved this error, and I manually rejudged several affected submissions (at least one from each user who posted since the mistake); the number of accepted users has increased from 49 to 63.

Please resubmit if I missed you or you believe you may have been affected.

What does per second per second mean?
The acceleration due to gravity is g metres per second per second

This will make sense once you've had exposure to elementary physics.

per second per second?
it repeats twice!

the short of it:

how fast you go is change in displacement, measured in [metres] per second. (velocity.)
how fast you're increasing how fast you go is change in velocity, measured in [metres per second] per second. (acceleration.)

I'm not sure why my program doesn't work

You are experiencing significant loss of precision.

Edit: I was wrong. Your code was right, and the judge was wrong. I apologise.

OK, so I tried all sorts of rounding methods, but I keep getting the wrong answer. In the sample input, my program rounds the speed of the stone to 31.93. How was the sample input rounded, because the full answer is around 31.929799, yet the sample output says only 31.90?

The exact answer is actually

How are you supposed to do this questions? How come it's so hard when it's only worth 3 points? If anybody knows, can they give me the formuala in words that I can actually UNDERSTAND? THANK YOU!!!

It's not hard; it just requires a basic understanding of high school algebra and physics. The point value stands. (I even gave you the equations of kinematics you need to solve this!)

Well then could you tell me the meaning of the equations? It's so hard to understand when your only in grade 7.

These equations describe uniformly accelerated linear motion, where Δt is elapsed time, Δd is displacement, v₁ is initial velocity, v₂ is final velocity, and a is acceleration.

I recommend simply not doing this question until you've taken Grade 11 Physics.

I will listen to your advice. TY.

No need for physics here, I just BF'ed.
Digital technology's so great (compared to analog) as you can just set an arbitrary precision depending on how precise the situation needs (with the equivalent time costs, of course).

I can't find anything wrong in my equation.

I haven't read the problem, so I can't comment on who's doing what right, but Sour Spinach has a different algorithm to get 5/5. Notice the time his solution took.

Edit: But, according to the analysis, it's not necessary. So I don't actually know what's going on.

Aah, you don't know how close you are! You forgot to divide by 2 when using the fourth equation, most likely.


How do people in Grade 6-7 do this program (how is it only 2 points!!!)? We don't know anything about this physics stuff (or something like that).

It's for didactic purposes only. Although, since, when I think of it, the same can be said for all problems on the judge, I guess it should be 3 points, since it's harder than A plus B, and around the difficulty of an easy CCC problem.

Thanks for the equations! smile.gif