The three edges of a triangle can be added to a graph to observe
Suppose you add the nth triangle
The first n-1 triangle divides the area into sum[n-1]
The nth triangle can pass up to two sides of each triangle on each edge of the first n-1 triangle, and one edge is cut to increase the n-1-1 area.
Then the three edges of the internal graph are cut to increase the 6* (n-1)-3 regions, and the new triangle itself in three corners of the formation of three new areas
The 6* (n-1) area has been added to a total of
Then the recursive function is
Sum[i] = sum[i-1] + 6* (i-1)
In fact, the direct point is to use the Euler formula to solve the problem
V (Point)-E (Edge) + F (face) = 2
Add nth triangles at a time
The added point is 2 * (n-1) * 3 + 3 = 6*n-3
Added side for (2*n-1) * * (new triangle added edge) + n-1 (original n-1 triangle each three edges are divided by the new triangle two times) = 6*n-9
So the last increase in the number of polygons is 6* (n-1)
1#include <cstdio>2 3 intsum[10005];4 5 intMain ()6 {7sum[1] =2;8 for(inti =2; i<=10000; i++)9Sum[i] = sum[i-1] +3*2* (I-1);Ten intT, N; Onescanf"%d", &T); A while(t--){ -scanf"%d", &n); -printf"%d\n", Sum[n]); the } - return 0; -}
HDU 12,493 Corner-shaped Division