重新着色AI (CI翻译)
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.
给定一个大小为 $*n* × *m*$ 的棋盘。在第 0 分钟,我们将所有黑色格子重新涂成颜色 0。在第 $*i*$ 分钟,我们将初始为黑色且恰好有四个角相邻格子都已涂成 $*i* - 1$ 的格子重新涂成颜色 $*i*$(所有这样的格子同时重新着色)。这个过程无限进行。请你求出恰好被重新着色 $*x*$ 次的格子数。AI (CI翻译)
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.
假设棋盘左上角的格子始终为黑色。如果两个格子恰好有一个公共顶点,则称它们角相邻。AI (CI翻译)
Input
输入格式
AI (CI翻译)The first line contains integers $*n*$ and $*m*$ ($1 ≤ *n*, *m* ≤ 5000$). The second line contains integer $*x*$ ($1 ≤ *x* ≤ 10^{9}$).
第一行包含两个整数 $*n*$ 和 $*m*$($1 ≤ *n*, *m* ≤ 5000$)。第二行包含整数 $*x*$($1 ≤ *x* ≤ 10^{9}$)。AI (CI翻译)
Output
输出格式
AI (CI翻译)Print how many squares will be painted exactly $*x*$ times.
输出恰好被涂色 $*x*$ 次的格子数。AI (CI翻译)
样例
3 3
1
4
3 3
2
1
1 1
1
1
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。