## DMOPC '14 Exam Time P2 - Physics Duel

View as PDF

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem types
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Having mastered the secrets to the Art of Kinematics, you decide to show your power by challenging your physics teacher to a duel — a friendly one that is. The two of you are separated by a certain distance and right in the middle lies the holy book of SIN (more specifically, A Decade of SIN Plus Sixteen, which contains past contests and solutions to the University of Waterloo's Sir Isaac Newton Contest).

You believe you are worthy of bringing the book (which has a mass of 500.0g) home to solve problems from — but she wants you to suffer first. Using the force (yes, that force), she changes the velocity of the book several times. Since you are keeping your eyes on the clock, you know the exact time when she changes the velocity of the book and you also know the angle (as you always carry a protractor) and the duration of the time interval (you also have a stopwatch).

Your goal is to output the speed of the book when it hits the ground. Assume that the book is in free-fall on Earth after the last change in velocity is made and that it is accelerating towards the surface at . Assume that the book is unaffected by gravity while it is under the influence of the force.

#### Input Specification

The first line of input will contain one number that represents the number of changes.

The next lines will contain two integers and a real number, , and .

represents the speed of the book, in metres per second while represents the direction, in degrees. More specifically, is the angle between the book's direction and the east direction, clockwise.

represents the time, in seconds, that the book travelled for. Note that is given to one decimal place.

#### Output Specification

The only line of output is to contain the speed of the book when it hits the ground to the nearest integer.

#### Sample Input

2
10 30 2.0
5 120 1.5

#### Sample Output

18

#### Explanation for Sample Input

Our goal is to find the height the book reaches. Using the Law of Conservation of Energy we derive the following equation: , where is the height the book reached, is the acceleration due to gravity and represents the speed of the book when it lands on the ground (the desired output).

To obtain the height the book reached, we need to obtain the vertical component of the book's velocity in each of the lines.

Let represent the height that the book reaches.

Using ,

Note:
The function in your language may require the input to be in radians rather than degrees.
To convert from degrees (the input) to radians, simply multiply by .

• commented on June 21, 2016, 10:46 a.m.

This is 4th on the best submissions page, but is only 99/100. Why is this?

• commented on June 21, 2016, 12:31 p.m. edit 4

This is a historical mistake on our part, thanks for letting us know! I've opened a ticket for it, with more detailed info there.

• commented on April 14, 2016, 10:39 p.m.

In the question, I think there's an extra close bracket after

• commented on April 14, 2016, 11:46 p.m.

Fixed.

• commented on Jan. 13, 2015, 4:05 p.m.

in input specification, the second s is x

• commented on Jan. 13, 2015, 4:47 p.m.

Fixed.