CF40B.Repaintings

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

给定一个 n×mn \times m 的棋盘。在第 00 分钟,我们将所有初始为黑色的方格重绘为颜色 00。在第 ii 分钟,我们将所有初始为黑色且其四个对角相邻方格均被绘制为颜色 i−1i-1 的方格重绘为颜色 ii(所有满足条件的方格同时重绘)。该过程无限进行下去。你需要计算恰好被重绘了 xx 次的方格数量。

棋盘左上角的方格始终视为黑色。若两个方格恰好有一个公共顶点,则称它们为对角相邻。

输入格式

The first line contains integers n and m (1 ≤ n, m ≤ 5000). The second line contains integer x (1 ≤ x ≤ 109).

第一行包含整数 nn 和 mm(1 ≤ n, m ≤ 50001 \le n, m \le 5000)。第二行包含整数 xx(1 ≤ x ≤ 1091 \le x \le 10^9)。

输出格式

Print how many squares will be painted exactly x times.

输出恰好被涂色 x 次的正方形的数量。

输入输出样例

  • 输入#1

    3 3
    1

    输出#1

    4
  • 输入#2

    3 3
    2

    输出#2

    1
  • 输入#3

    1 1
    1

    输出#3

    1

输入解题思路,AI测评打分。不知道怎么写?

首页