Portal: Click to open the link
Title: Give a cuboid with side lengths A, B, and C. Then give n spatial positions, which means to dig a small cube with side length 1 at this position. Find the surface area of this three-dimensional figure after digging n positions.
Thinking: It looks very complicated, but it is very, very simple when you think about it carefully.
First of all, for a small cube, there are 6 faces, we first consider the two opposite faces.
In an opposing face, if there are entities on both sides, then the surface area will be +2 after digging out the small cube
In an opposing face, only one side has entities , Then the surface area will not change after digging out this small cube
In an opposing surface, both sides have been dug away, then the surface area will be -2 after digging out this small cube
< /p>
So, I just need to discuss whether a certain position is vacant. Obviously, it can be maintained with set.
So this question is basically solved.
#include