atcoder#AGC004A. [AGC004A] Divide a Cuboid
[AGC004A] Divide a Cuboid
Score : points
Problem Statement
We have a rectangular parallelepiped of size , built with blocks of size . Snuke will paint each of the blocks either red or blue, so that:
- There is at least one red block and at least one blue block.
- The union of all red blocks forms a rectangular parallelepiped.
- The union of all blue blocks forms a rectangular parallelepiped.
Snuke wants to minimize the difference between the number of red blocks and the number of blue blocks. Find the minimum possible difference.
Constraints
Input
The input is given from Standard Input in the following format:
Output
Print the minimum possible difference between the number of red blocks and the number of blue blocks.
3 3 3
9
For example, Snuke can paint the blocks as shown in the diagram below. There are red blocks and blue blocks, thus the difference is .
2 2 4
0
For example, Snuke can paint the blocks as shown in the diagram below. There are red blocks and blue blocks, thus the difference is .
5 3 5
15
For example, Snuke can paint the blocks as shown in the diagram below. There are red blocks and blue blocks, thus the difference is .