A12028 | Golden Plate
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into $w\times h$ cells. There should be $k$ gilded rings, the first one should go along the edge of the plate, the second one — $2$ cells away from the edge and so on. Each ring has a width of $1$ cell. Formally, the $i$ -th of these rings should consist of all bordering cells on the inner rectangle of size $(w - 4(i - 1))\times(h - 4(i - 1))$ .
The picture corresponds to the third example.Your task is to compute the number of cells to be gilded.
The picture corresponds to the third example.Your task is to compute the number of cells to be gilded.
输入格式
The only line contains three integers $w$ , $h$ and $k$ ( $3 \le w, h \le 100$ , $1 \le k \le \left\lfloor \frac{min(n, m) + 1}{4}\right\rfloor$ , where $\lfloor x \rfloor$ denotes the number $x$ rounded down) — the number of rows, columns and the number of rings, respectively.
输出格式
Print a single positive integer — the number of cells to be gilded.
输入输出样例
输入 #1
3 3 1
输出 #1
8
输入 #2
7 9 1
输出 #2
28
输入 #3
7 9 2
输出 #3
40
The first example is shown on the picture below.
The second example is shown on the picture below.
The third example is shown in the problem description.
The second example is shown on the picture below.
The third example is shown in the problem description.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted