A7911 | Testing
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
You take part in the testing of new weapon. For the testing a polygon was created. The polygon is a rectangular field $n×m$ in size, divided into unit squares $1×1$ in size. The polygon contains $k$ objects, each of which is a rectangle with sides, parallel to the polygon sides and entirely occupying several unit squares. The objects don't intersect and don't touch each other.
The principle according to which the weapon works is highly secret. You only know that one can use it to strike any rectangular area whose area is not equal to zero with sides, parallel to the sides of the polygon. The area must completely cover some of the unit squares into which the polygon is divided and it must not touch the other squares. Of course the area mustn't cross the polygon border. Your task is as follows: you should hit no less than one and no more than three rectangular objects. Each object must either lay completely inside the area (in that case it is considered to be hit), or lay completely outside the area.
Find the number of ways of hitting.
The principle according to which the weapon works is highly secret. You only know that one can use it to strike any rectangular area whose area is not equal to zero with sides, parallel to the sides of the polygon. The area must completely cover some of the unit squares into which the polygon is divided and it must not touch the other squares. Of course the area mustn't cross the polygon border. Your task is as follows: you should hit no less than one and no more than three rectangular objects. Each object must either lay completely inside the area (in that case it is considered to be hit), or lay completely outside the area.
Find the number of ways of hitting.
输入格式
The first line has three integers $n$ , $m$ и $k$ ( $1<=n,m<=1000$ , $1<=k<=90$ ) — the sizes of the polygon and the number of objects on it respectively. Next $n$ lines contain $m$ symbols each and describe the polygon. The symbol "\*" stands for a square occupied an object, whereas the symbol "." stands for an empty space. The symbols "\*" form exactly $k$ rectangular connected areas that meet the requirements of the task.
输出格式
Output a single number — the number of different ways to hit a target.
输入输出样例
输入 #1
3 3 3 *.* ... *..
输出 #1
21
输入 #2
4 5 4 .*.** ...** **... ...**
输出 #2
38
输入 #3
2 2 1 .* ..
输出 #3
4
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted