Http://ncc.neuq.edu.cn/oj/problem.php? Id = 1017
It is mainly a summary of mathematical formulas;
N = 0, F = 1;
N = 1, F = 2;
N = 2, F = 12;
N = 3, F = 31;
Each line segment of each lightning-shaped line must pass through all three lines of the previous lightning-shaped line.
For example, when n = 2:
A total of 12 planes.
We will discuss the change in the number of intersections,
When N = 2 and the second line appears, each line segment of the lightning-shaped line passes through all three lines of the lightning-shaped line. In this way, the number of intersections will increase by 3*3;
When n = 3 and the second line appears, each line segment of the lightning-shaped line passes through all six lines of the lightning-shaped line segment. In this way, the number of intersections will increase by 3*6;
When N = 4 and the second line appears, each line segment of the lightning-shaped line passes through all nine lines of the lightning-shaped line. In this way, the number of intersections will increase by 3*9;
............
............
The number of intersections is related to the number of planes. It can be seen that the number of intersections increases by 1:
So the formula is: F [I] = f [I-1] + 3*(3 * (I-1) + 1;
Simplified: F [I] = f [I-1] + 9 * I-8;
# Include <iostream> using namespace STD; int f [10010]; int main () {f [0] = 1; for (INT I = 1; I <10001; I ++) {f [I] = f [I-1] + 9 * I-8;} int t; CIN> T; while (t --) {int; cin> A; cout <F [a] <Endl;} return 0 ;}