I. Rotation

Codeforces
IDCF100I
Time2000ms
Memory64MB
Difficulty
geometrymath
English · Original
Chinese · Translation
Formal · Original
Ehsan loves geometry! Especially he likes to rotate points! Given a point in the plane, Ehsan likes to rotate it by _k_ degrees (counter-clockwise), around the origin. What is the result of this rotation? ## Input A single integer _k_ (0 ≤ _k_ < 360) is given in the first line. Two integer numbers _x_ and _y_ are given in the second line ( - 1390 ≤ _x_, _y_ ≤ 1390). ## Output Write two numbers. The result of the rotation. Your answer must have a relative error less than 10 - 1. [samples]
Ehsan 热爱几何!尤其是他喜欢旋转点! 给定平面上的一个点,Ehsan 喜欢将其绕 #cf_span(class=[tex-font-style-underline], body=[origin]) 逆时针旋转 #cf_span[k] 度。旋转后的结果是什么? 第一行给出一个整数 #cf_span[k](#cf_span[0 ≤ k < 360])。第二行给出两个整数 #cf_span[x] 和 #cf_span[y](#cf_span[ - 1390 ≤ x, y ≤ 1390])。 请输出两个数,即旋转后的结果。你的答案的相对误差必须小于 #cf_span[10 - 1]。 ## Input 第一行给出一个整数 #cf_span[k](#cf_span[0 ≤ k < 360])。第二行给出两个整数 #cf_span[x] 和 #cf_span[y](#cf_span[ - 1390 ≤ x, y ≤ 1390])。 ## Output 请输出两个数,即旋转后的结果。你的答案的相对误差必须小于 #cf_span[10 - 1]。 [samples]
**Definitions** Let $ k \in \mathbb{Z} $ with $ 0 \leq k < 360 $ be the rotation angle in degrees. Let $ (x, y) \in \mathbb{R}^2 $ be the coordinates of the point to be rotated about the origin. **Constraints** $ -1390 \leq x, y \leq 1390 $ **Objective** Compute the rotated point $ (x', y') $ obtained by rotating $ (x, y) $ counter-clockwise by $ k $ degrees about the origin: $$ \begin{aligned} x' &= x \cos \theta - y \sin \theta \\ y' &= x \sin \theta + y \cos \theta \end{aligned} $$ where $ \theta = \frac{\pi k}{180} $ radians. Output $ (x', y') $ with relative error less than $ 10^{-1} $.
Samples
Input #1
90
1 1
Output #1
\-1.00000000 1.00000000
Input #2
180
1 1390
Output #2
\-1.00000000 -1390.00000000
API Response (JSON)
{
  "problem": {
    "name": "I. Rotation",
    "description": {
      "content": "Ehsan loves geometry! Especially he likes to rotate points! Given a point in the plane, Ehsan likes to rotate it by _k_ degrees (counter-clockwise), around the origin. What is the result of this rota",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 65536
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF100I"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Ehsan loves geometry! Especially he likes to rotate points!\n\nGiven a point in the plane, Ehsan likes to rotate it by _k_ degrees (counter-clockwise), around the origin. What is the result of this rota...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "Ehsan 热爱几何!尤其是他喜欢旋转点!\n\n给定平面上的一个点,Ehsan 喜欢将其绕 #cf_span(class=[tex-font-style-underline], body=[origin]) 逆时针旋转 #cf_span[k] 度。旋转后的结果是什么?\n\n第一行给出一个整数 #cf_span[k](#cf_span[0 ≤ k < 360])。第二行给出两个整数 #cf_span[x...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ k \\in \\mathbb{Z} $ with $ 0 \\leq k < 360 $ be the rotation angle in degrees.  \nLet $ (x, y) \\in \\mathbb{R}^2 $ be the coordinates of the point to be rotated about the origin.\n\n...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments