065. Intersection of Two Lines

Codeforces
IDCF10269065
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
When performing calculations on linear equations, finding the intersection point of two lines is a very common task. Write a program that takes two linear equations in the form of $y = m x + b$ and outputs the $x$ coordinate at which the two lines intersect. The first line contains two floating point values representing the $m$ and $b$ values of the first linear equation respectively. The second line contains the two variables corresponding to the $m$ and $b$ variables of the second linear equation. A single floating point value that represents the $x$ coordinate at which the two lines intersect. Assume that all test cases contain lines that do intersect. ## Input The first line contains two floating point values representing the $m$ and $b$ values of the first linear equation respectively. The second line contains the two variables corresponding to the $m$ and $b$ variables of the second linear equation. ## Output A single floating point value that represents the $x$ coordinate at which the two lines intersect. [samples] ## Note Assume that all test cases contain lines that do intersect.
**Definitions** Let $ m_1, b_1 \in \mathbb{R} $ be the slope and y-intercept of the first line. Let $ m_2, b_2 \in \mathbb{R} $ be the slope and y-intercept of the second line. **Constraints** 1. $ m_1 \neq m_2 $ (lines intersect at exactly one point). **Objective** Find the $ x $-coordinate of the intersection point: $$ x = \frac{b_2 - b_1}{m_1 - m_2} $$
API Response (JSON)
{
  "problem": {
    "name": "065. Intersection of Two Lines",
    "description": {
      "content": "When performing calculations on linear equations, finding the intersection point of two lines is a very common task. Write a program that takes two linear equations in the form of $y = m x + b$ and ou",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269065"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "When performing calculations on linear equations, finding the intersection point of two lines is a very common task. Write a program that takes two linear equations in the form of $y = m x + b$ and ou...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ m_1, b_1 \\in \\mathbb{R} $ be the slope and y-intercept of the first line.  \nLet $ m_2, b_2 \\in \\mathbb{R} $ be the slope and y-intercept of the second line.  \n\n**Constraints** ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments