403147: GYM101047 C Robotics Competition
Description
Malai advanced to the Thai national robotics contest finals, to be held next week. Each contestant specifies an instruction to her or his robot and the number of times this instruction should be executed. The robot that gets to closest to a certain target wins the contest.
Each robot is represented by a point (x, y) and it starts at the origin of the plane. Each instruction is defined as I(α, ), where α is an angle in degrees and a distance in meters. To execute instruction I(α, ), the robot must rotate α degrees counterclockwise around the origin and then move meters to the right from its position.
The image shows the execution of the instruction I(90, 10) three times.
Malai is a newbie at this contest and needs your help to find the robot's final position.
InputThe first line has a single integer T, the number of test cases.
Each test case contains a single line with an angle α, a distance and an integer n, the number of times that the instruction I(α, ) must be executed. You can assume α and are rational values.
Limits
- 1 ≤ T ≤ 500
- 0 ≤ n ≤ 109
- 0 ≤ α < 360
For each test case, print one line with the coordinates (x, y), in meters, of the final position of the robot, after n executions of the instruction I(α, ). The error should not be greater than 10 - 4.
ExampleInput4Output
90 10 1
90 10 2
90 10 3
30 1.5 121
10 0
10 10
0 10
1.5 0