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)