144. Triangulation Rocks the Nation

Codeforces
IDCF10269144
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
You have a triangle with three points given in coordinates. Given this information, figure out the triangle's area. The points can be given in any order. To calculate the area of a triangle, you can use Heron's Formula, which is described below: Define $A$, $B$, and $C$ to be the lengths of the three sides of the triangle. Define $S$ to be equal to $frac(A + B + C, 2)$. Then, the area of the triangle is calculated as $sqrt(S (S -A) (S -B) (S -C))$. The input consists of three lines, each consisting of two space-separated integers $x$ and $y$: the coordinates of each point of the triangle. Output a single decimal number $a$: the area of the triangle, using Heron's Formula as described above. Do not round your answer. This triangle corresponds to the first example case: ## Input The input consists of three lines, each consisting of two space-separated integers $x$ and $y$: the coordinates of each point of the triangle. ## Output Output a single decimal number $a$: the area of the triangle, using Heron's Formula as described above. Do not round your answer. [samples] ## Note This triangle corresponds to the first example case:
**Definitions** Let $ P_1 = (x_1, y_1) $, $ P_2 = (x_2, y_2) $, $ P_3 = (x_3, y_3) \in \mathbb{R}^2 $ be the coordinates of the three vertices of the triangle. **Constraints** The coordinates are given as real numbers (integers in input, but treated as reals for computation). **Objective** Compute the area of the triangle using Heron’s Formula: 1. Compute side lengths: $$ A = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}, \quad B = \sqrt{(x_3 - x_2)^2 + (y_3 - y_2)^2}, \quad C = \sqrt{(x_1 - x_3)^2 + (y_1 - y_3)^2} $$ 2. Compute semi-perimeter: $$ S = \frac{A + B + C}{2} $$ 3. Compute area: $$ \text{Area} = \sqrt{S(S - A)(S - B)(S - C)} $$
API Response (JSON)
{
  "problem": {
    "name": "144. Triangulation Rocks the Nation",
    "description": {
      "content": "You have a triangle with three points given in coordinates. Given this information, figure out the triangle's area. The points can be given in any order. To calculate the area of a triangle, you can ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269144"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You have a triangle with three points given in coordinates. Given this information, figure out the triangle's area. The points can be given in any order.\n\nTo calculate the area of a triangle, you can ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ P_1 = (x_1, y_1) $, $ P_2 = (x_2, y_2) $, $ P_3 = (x_3, y_3) \\in \\mathbb{R}^2 $ be the coordinates of the three vertices of the triangle.\n\n**Constraints**  \nThe coordinates are...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments