From
Http://www.cnblogs.com/chaosheng/archive/2012/01/26/2329583.html
(1) n straight lines can be divided into a maximum of n areas.
Analysis: You may have seen this question before. This is at best a junior high school question.
However, a type of question can be easily discovered only by starting with a simple one.
When there are n-1 lines, the plane can be divided into a maximum of f (n-1) areas.
If the n-th line has the largest number of cut-in areas, it must intersection each line and cannot have the same intersection.
In this way, n-1 intersections are obtained. These links divide the nth line into two rays and The N-2 line is broken.
Each Ray and line break will be split into two parts in some areas. So there are 2 + (n-2) more areas.
So: f (n) = f (n-1) + n
= F (n-2) + (n-1) + n ......
= F (1) + 1 + 2 + ...... + N
= N (n + 1)/2 + 1
(2) line split plane (hdu2050)
According to the line split plane, the intersection determines the number of rays and line segments, and then determines the number of new regions. When n-1 lines are broken, the number of areas is f (n-1 ).
To maximize the number of added areas, the line segments on both sides of the line must be at the same time as the n-1 line edges, that is, 2 * (n-1) line segments. The number of new lines is 4 * (n-1) and the number of rays is 2.
Note that only one area can be added to the adjacent two line segments.
Therefore, F (n) = f (n-1) + 4 (n-1) + 2-1
= F (n-1) + 4 (n-1) + 1
= F (n-2) + 4 (n-2) + 4 (n-1) + 2 ......
= F (1) + 4 + 4*2 + ...... + 4 (n-1) + (n-1)
= 2n ^ 2-N + 1
(3) The question of the closed curve is roughly as if there are N closed curves on the plane, and any two closed curves happen to be at two points,
If any of the three closed curves do not overlap at the same point, ask the number of areas that these closed curves divide the plane.
Analysis: When n-1 circles, the number of regions is F (n-1 ). then, the nth circle must be the first n-1 circle. Then, the nth circle is divided into 2 (n-1) segments, and 2 (n-1) areas are added.
So: F (n) = f (n-1) + 2 (n-1)
= F (1) + 2 + 4 + ...... + 2 (n-1)
= N ^ 2-N + 2
(4) The problem of plane split space (hdu1290) is determined by the two-dimensional split problem. The plane split is related to the intersection of lines, that is, the intersection determines the number of rays and line segments, this determines the number of new regions.
In 3D, is it related to the plane line? When there are n-1 planes, the number of split spaces is F (n-1 ).
To have the maximum number of spaces, the n-th plane must intersection the first n-1 plane and cannot have a common intersection.
That is, there can be up to n-1 lines. The N-1 line splits the n-th plane into a maximum of g (n-1) areas.
(G (n) is the number of straight line split planes in (1) This plane splits the original space into two, then a maximum of N-1-1 space is added.
Therefore, F = f (n-1) + g (n-1)
PS: G (n) = n (n + 1)/2 + 1
= F (n-2) + g (n-2) + g (n-1 )......
= F (1) + G (1) + G (2) + ...... + G (n-1)
= 2 + (1*2 + 2*3 + 3*4 + ...... + (N-1) N)/2 + (n-1)
= (1 + 2 ^ 2 + 3 ^ 2 + 4 ^ 2 + ...... + N ^ 2-1-2-3 -...... -N)/2 + n + 1
= (N ^ 3 + 5n)/6 + 1