/* Give You A cube with a side length of N and cut it into N x n cubes per unit volume. Find the logarithm of the cube with a number of common vertices <= 2. The number of public points may be: 0, 1, 2, 4. We can use the total logarithm to subtract the logarithm of four public points. Total logarithm: N ^ 3 * (N ^ 3-1)/2 (a total of N ^ 3 small blocks, from which two blocks are selected) the cube pairs at the four intersections are two cubes in common, so we only need to find the number of common faces in each unit of area in a large cube, the result is as follows: N ^ 3 * (N ^ 3-1)/2-3 * n ^ 2 (n-1) */# include <stdio. h> # include <algorithm> # include <string. h> using namespace STD; int main () {int N; while (~ Scanf ("% d", & N) {printf ("% d \ n", (N * n * N-1 )) /2-3 * n * (n-1);} return 0 ;}
HDU 1220 cube (combined mathematics)