Analytical:
1, n line divides the plane into the number of regions: F (N) =f (n-1) +n=n (n+1)/2+1;
2, divides the space to the most region number time, the nth plane and the front (n-1) plane intersects, and does not have the three sides collinear, therefore this plane and the front (n-1) plane has (n-1) the intersection line. The intersection divides the nth plane into an F (n-1) region, so the plane divides the original space into two, increasing the F (n-1) space, the recursive formula: g (n) =g (n-1) +f (n-1) = (n^3+5n)/6+1.
3, this kind of problem generally has a fixed formula, two-dimensional general is f (x) =a*x^2+b*x+c, three-dimensional is generally f (x) =a*x^3+b*x^2+c*x+d, with the fixed coefficient method to find out each coefficient is ok.
#include <iostream> using namespace Std;int main () {int n;while (cin>>n) {cout<< (n*n*n+5*n) /6+1<<endl;} return 0; }
HDU ACM 1290 is dedicated to Hangzhou Electric 50 Anniversary Celebration Gift