HDU ACM 1290 is dedicated to Hangzhou Electric 50 Anniversary Celebration Gift

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.