Connected Graph
题号:NC51209
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
64bit IO Format: %lld

题目描述

An undirected graph is a set V of vertices and a set of edges.An undirected graph is connected if and only if for every pair (u,v) of vertices,u is reachable from v.
You are to write a program that tries to calculate the number of different connected undirected graph with n vertices.
For example,there are 4 different connected undirected graphs with 3 vertices.

输入描述:

The input contains several test cases. Each test case contains an integer n, denoting the number of vertices. You may assume that . The last test case is followed by one zero.

输出描述:

For each test case output the answer on a single line.
示例1

输入

复制
1
2
3
4
0

输出

复制
1
1
4
38