VM7WC '15 #3 Bronze - M's Theorem!

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

In M's class, Andrew is currently learning the chain rule (see Melanie's Theorem) for adding vectors. He's tried adding vectors tip-to-tail, but since he has no skill in math he's unable to do so. Your job is to create a program to add a series of vectors to help Andrew solve his physics problems.

You will be given vectors in the form of a magnitude and angle. Andrew's physics problems use angles in the standard unit circle convention (i.e. starting from the right hand side going counterclockwise), and all angles are positive. You may assume that the tail of the first vector is at the origin.

Input Specification

The first line of input, , will consist of the number of vectors to be added.

The next lines will consist of a magnitude, , and an angle in degrees, . You should note that angles may be greater than degrees.

Output Specification

Your program should output the resultant vector's magnitude and angle, with a single space in between them. Both values should be rounded to the nearest whole number. Your angle must be greater or equal to and less than .

Sample Input

3
4 100
2 10
5 330

Sample Output

6 18

• commented on Jan. 22, 2015, 8:32 p.m.

There seems to be a lack of information on Melanie's theorem on the web. Notably, its Wikipedia page has been deleted. Could some information be provided on its use?

Thanks,

hob

• commented on Jan. 22, 2015, 8:46 p.m.

It is irrelevant to the problem.

• commented on Jan. 22, 2015, 8:57 p.m.

Does this problem require some next level vector graphing parabola humdinger in the hood?

• commented on Jan. 22, 2015, 10:07 p.m.

It requires (relatively) elementary mathematical knowledge for a contest programmer. I guess in Ontario you would learn this in grade 10 but it's really not as difficult as you think.

• commented on Jan. 23, 2015, 12:14 p.m.

Oh xD

• commented on Jan. 23, 2015, 5:30 p.m.

Melanie's theorem was removed due to lack of sufficient sourcing. However, I assure you that it remains the best way to add relative vectors. In case you haven't heard of it, it is also known as the chain rule.