K. Wolf and sheep

Codeforces
IDCF10049K
Time2000ms
Memory256MB
Difficulty
English · Original
Formal · Original
A sheep lives on an infinite field. The sheep wants to eat some grass. Grass only exists in one place. That place is a circle defined by a center point (Gx, Gy) and a radius Gr. The sheep would gladly eat all the grass. But if you read the title of this task you noticed that there is also a wolf on that field. The wolf wants to eat the sheep, but we don't want that to happen. The wolf is tied to a pole at position (Wx, Wy) with a rope of length Wr. Find the area of grass that the sheep can eat without being eaten by the wolf. We can assume that the sheep starts in a safe location. The first line contains the number of test cases T (1 ≤ T ≤ 10000). Each test case consists of 2 lines. The first line contains integers Gx, Gy and Gr. The second line contains integers Wx, Wy and Wr. ( - 105 ≤ Gx, Gy, Wx, Wy ≤ 105, 1 ≤ Gr, Wr ≤ 105) For each test case output one line containing “_Case #tc: A_”, where tc is the number of the test case (starting from 1) and A is the area of grass that the sheep can eat safely with a maximum absolute or relative error of *10 - 6*. ## Input The first line contains the number of test cases T (1 ≤ T ≤ 10000). Each test case consists of 2 lines. The first line contains integers Gx, Gy and Gr. The second line contains integers Wx, Wy and Wr. ( - 105 ≤ Gx, Gy, Wx, Wy ≤ 105, 1 ≤ Gr, Wr ≤ 105) ## Output For each test case output one line containing “_Case #tc: A_”, where tc is the number of the test case (starting from 1) and A is the area of grass that the sheep can eat safely with a maximum absolute or relative error of *10 - 6*. [samples]
**Definitions** Let $ T \in \mathbb{Z} $ be the number of test cases. For each test case $ k \in \{1, \dots, T\} $: - Let $ C_G = (G_x, G_y) \in \mathbb{R}^2 $ be the center of the grass circle with radius $ G_r \in \mathbb{R}^+ $. - Let $ C_W = (W_x, W_y) \in \mathbb{R}^2 $ be the center of the wolf's reach circle with radius $ W_r \in \mathbb{R}^+ $. **Constraints** 1. $ 1 \le T \le 10000 $ 2. $ -10^5 \le G_x, G_y, W_x, W_y \le 10^5 $ 3. $ 1 \le G_r, W_r \le 10^5 $ **Objective** For each test case $ k $, compute the area of the grass circle $ C_G $ that lies outside the wolf's reach circle $ C_W $: $$ A_k = \text{Area}(C_G \setminus C_W) $$ That is, the area of the disk centered at $ C_G $ with radius $ G_r $, minus the area of its intersection with the disk centered at $ C_W $ with radius $ W_r $.
API Response (JSON)
{
  "problem": {
    "name": "K. Wolf and sheep",
    "description": {
      "content": "A sheep lives on an infinite field. The sheep wants to eat some grass. Grass only exists in one place. That place is a circle defined by a center point (Gx, Gy) and a radius Gr. The sheep would gladl",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10049K"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "A sheep lives on an infinite field. The sheep wants to eat some grass. Grass only exists in one place. That place is a circle defined by a center point (Gx, Gy) and a radius Gr.\n\nThe sheep would gladl...",
      "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\\} $:  \n- Let $ C_G = (G_x, G_y) \\in \\mathbb{R}^2 $ be the center of the grass circle ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments