ASC (22) H (large number + push formula)

Source: Internet
Author: User
High Speed trainstime limit: 4000/2000 ms (Java/others) memory limit: 128000/64000 KB (Java/others) submitstatisticnext problemproblem description

The Kingdom of flatland has n cities. recently the king of flatland visited Japan and was amazed by high speed trains shinkansens going all around the country. therefore he decided to build the system of high speed trains in Flatland.

Each high speed train line will be bidirectional and connect exactly two different cities of Flatland. although there is actually no need of high speed trains in flatland, the king ordered that there must be at least one high speed train line from each city of Flatland.
The Minister of Transportation told the king that there are several train system satisfying his requirements. The king was amazed by the fact and asked the Minister to count the number of possible systems.
Help the Minister to calculate the number of train systems.

Input the input file contains one integer number N (2 ≤ n ≤ 100) Output output one integer number-the number of different train systems that can be arranged in Flatland. sample input
4
Sample output
41

Question: The number of points n in a graph is defined as the number of graph types that can be composed of the N points. Each point must be connected with at least one edge and at most one edge between the two points, the graph can be unconnected.
Idea: Push formula questions
DP [N] = DP [n-1] * (2 ^ (n-1)-1) + C (n-1, 1) * 2 ^ (n-2) * DP [N-2] + C (n-1, 2) * 2 ^ (n-3) * DP [n-3] + ...... + C (n-1, n-3) * 2 ^ (2) * DP [2] + 1
Use a large number

ASC (22) H (large number + push formula)

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.