> For the complete documentation index, see [llms.txt](https://docs.1l.lol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.1l.lol/advanced-math/algebra-geometry.md).

# 代数与平面几何

### 方程

* **一元一次方程** ax + b = 0，解 x = -b / a（a ≠ 0）
* **二元一次方程组**：代入消元或加减消元

```cpp
// 解 ax + by = c, dx + ey = f
double det = a * e - b * d;
double x = (c * e - b * f) / det;
double y = (a * f - c * d) / det;
```

### 平面几何基础

| 图形  | 公式                     |
| --- | ---------------------- |
| 长方形 | 面积 = 长 × 宽，周长 = 2(长+宽) |
| 三角形 | 面积 = 底 × 高 / 2         |
| 圆   | 面积 = πr²，周长 = 2πr      |

### 两点距离

d = sqrt((x1-x2)² + (y1-y2)²)

```cpp
double dist(double x1, double y1, double x2, double y2) {
    return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}
```

### 计算几何常用

* 向量叉积判断方向 / 求面积
* 判断三点共线、点在多边形内
* 注意浮点误差，用 eps = 1e-9 比较


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.1l.lol/advanced-math/algebra-geometry.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
