300197: CF40B. Repaintings

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Repaintings

题意翻译

有一个 $n \times m$ 大小的棋盘。在 $0$ 分钟时,我们会将所有的黑色的方块重新绘制成 $0$ 色。在 $i$ 分钟期间,我们将最初的黑方块重新绘制成 $i$ 颜色,与这些方块正好有四个角相邻的方块被绘制为 $i - 1$ 颜色(所有的方块在同时被重新绘制)。这个过程一直在进行着,你要计算出我们到底画了多少个方块。 必须要假设棋盘左上角的方块总是黑色的。如果两个正方形恰好有一个公共点,则称它们为角相邻。

题目描述

A chessboard $ n×m $ in size is given. During the zero minute we repaint all the black squares to the 0 color. During the $ i $ -th minute we repaint to the $ i $ color the initially black squares that have exactly four corner-adjacent squares painted $ i-1 $ (all such squares are repainted simultaneously). This process continues ad infinitum. You have to figure out how many squares we repainted exactly $ x $ times. The upper left square of the board has to be assumed to be always black. Two squares are called corner-adjacent, if they have exactly one common point.

输入输出格式

输入格式


The first line contains integers $ n $ and $ m $ ( $ 1<=n,m<=5000 $ ). The second line contains integer $ x $ ( $ 1<=x<=10^{9} $ ).

输出格式


Print how many squares will be painted exactly $ x $ times.

输入输出样例

输入样例 #1

3 3
1

输出样例 #1

4

输入样例 #2

3 3
2

输出样例 #2

1

输入样例 #3

1 1
1

输出样例 #3

1

Input

题意翻译

### 题目描述 有一个 $n×m$ 的棋盘,左上角的格子被认为是黑色的。在第 $0$ 分钟时,我们会把所有棋盘上的黑色格子染成 $0$ 号颜色。这时,我们一直重复这样的操作:在第 $i$ 分钟时,如果其中一个格子所有相邻格的颜色都为 $i-1$ 时,并且这个格子最开始是一个黑色的格子,我们就会把这个格子涂成 $i$ 号颜色。(注:两个格子有一个公共点时,两个格子就是相邻的) ### 输入格式 第一行包含两个整数 $n,m(1≤n,m≤5000)$。 第二行输入一个整数 $x(1≤x≤10^9)$。 ### 输出格式 输出几个格子刚好被染了 $x$ 次颜色。

加入题单

算法标签: