> For the complete documentation index, see [llms.txt](https://blog.mcyou.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://blog.mcyou.cc/c++-mei-ri-yi-ti/c++-mei-ri-yi-ti-day-6-cha-huo-ba.md).

# C++每日一题 Day 6 插火把

***

lhy版权所有，禁止转载

### 知识点：二维数组

***

## 题目描述

有一天悠悠在“我的世界”开了一个n\*n的方阵，现在她有 m\*m 个火把和 k\*k 个萤石放在方阵里，没有光且没放东西的地方会生成怪物。请问在这个方阵中有几个点会生成怪物？

火把的照亮范围是：

```
|暗| 光 |暗|
|光|火把|光|
|暗| 光 |暗|
```

萤石：

```
|光| 光   |光|
|光| 萤石 |光|
|光| 光   |光|
```

## 输入

输入共m+k+1行，第一行为n,m,k。

第2到第m+1行分别是火把的位置xi、yi。

第m+2到第m+k+1行分别是萤石的位置oi、pi。

注：可能没有萤石，但一定有火把。

所有数据范围都在int范围内。

## 输出

会生成怪物的点的数量。

## 输入输出样例

**输入**

```
5 1 1
1 2
3 4
```

**输出**

```
7
```

***

## 回答要求

* 附上你完成本程序的完整代码
* 你有没有什么方法可以简化本题的代码？提示：数学方法


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://blog.mcyou.cc/c++-mei-ri-yi-ti/c++-mei-ri-yi-ti-day-6-cha-huo-ba.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
