AtCoder Beginner Contest 259 - B - Counterclockwise Rotation
Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 200 points
Problem Statement
In an xy-coordinate plane whose x-axis is oriented to the right and whose y-axis is oriented upwards, rotate a point (a,b) around the origin d degrees counterclockwise and find the new coordinates of the point.
Constraints
−1000≤a,b≤1000
1≤d≤360
All values in input are integers.
Input
Input is given from Standard Input in the following format:
abd
Output
Let the new coordinates of the point be (a′,b′). Print a′ and b′ in this order, with a space in between.
Your output will be considered correct when, for each value printed, the absolute or relative error from the answer is at most 10−6.
Sample Input 1
1
2 2180
Sample Output 1
1
-2-2
When (2,2) is rotated around the origin 180 degrees counterclockwise, it becomes the symmetric point of (2,2) with respect to the origin, which is (−2,−2).
Sample Input 2
1
5 0120
Sample Output 2
1
-2.49999999999999911182 4.33012701892219364908
When (5,0) is rotated around the origin 120 degrees counterclockwise, it becomes (−25​,253​​).
This sample output does not precisely match these values, but the errors are small enough to be considered correct.
Sample Input 3
1
0 011
Sample Output 3
1
0.000000000000000000000.00000000000000000000
Since (a,b) is the origin (the center of rotation), a rotation does not change its coordinates.
Sample Input 4
1
15 5360
Sample Output 4
1
15.000000000000001776364.99999999999999555911
A 360-degree rotation does not change the coordinates of a point.