{"problem":{"name":"C. Robotics Competition","description":{"content":"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 execu","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":65536},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10104C"},"statements":[{"statement_type":"Markdown","content":"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.\n\nEach 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.\n\nThe image shows the execution of the instruction I(90, 10) three times.\n\nMalai is a newbie at this contest and needs your help to find the robot's final position.\n\nThe first line has a single integer T, the number of test cases.\n\nEach 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.\n\n*Limits* \n\nFor 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.\n\n## Input\n\nThe 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   \n\n## Output\n\nFor 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.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case $ k \\in \\{1, \\dots, T\\} $, let:  \n- $ \\alpha_k \\in \\mathbb{Q} $ be the rotation angle in degrees,  \n- $ d_k \\in \\mathbb{Q} $ be the distance moved per instruction,  \n- $ n_k \\in \\mathbb{Z} $ be the number of instruction repetitions.  \n\nThe robot starts at position $ (x_0, y_0) = (0, 0) $.  \n\n**Constraints**  \n1. $ 1 \\le T \\le 1000 $  \n2. For each test case:  \n   - $ \\alpha_k \\in \\mathbb{Q} $, $ d_k \\in \\mathbb{Q} $, $ n_k \\in \\mathbb{Z} $, $ 1 \\le n_k \\le 100 $  \n\n**Objective**  \nFor each test case $ k $, compute the final position $ (x_k, y_k) $ after $ n_k $ executions of instruction $ I(\\alpha_k, d_k) $:  \n\nDefine the rotation matrix for angle $ \\theta = \\alpha_k \\cdot \\frac{\\pi}{180} $:  \n$$\nR(\\theta) = \\begin{bmatrix} \\cos\\theta & -\\sin\\theta \\\\ \\sin\\theta & \\cos\\theta \\end{bmatrix}\n$$\n\nThe displacement vector per instruction is $ \\vec{v} = \\begin{bmatrix} d_k \\\\ 0 \\end{bmatrix} $.  \n\nAfter $ n_k $ instructions, the position is:  \n$$\n(x_k, y_k) = \\sum_{i=0}^{n_k - 1} R(i \\theta) \\vec{v}\n$$\n\nThat is:  \n$$\n\\begin{bmatrix} x_k \\\\ y_k \\end{bmatrix} = d_k \\sum_{i=0}^{n_k - 1} \\begin{bmatrix} \\cos(i \\theta) \\\\ \\sin(i \\theta) \\end{bmatrix}\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10104C","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}