Select all or some people from n people and divide them into two parts, which requires that the minimum value of one part is greater than the maximum value of the other part.
Assume that the number of ac connections for n people is in ascending order. You can select m people (n => m> = 2 ),
Then, divide the m Individual into two groups (each group is required). If the minimum ac number is greater than the maximum ac number, you only need
Personal board. For example:
M Individual assume:
1, 2, 3, 4,... M-1 m (m Individual ac numbers are arranged from small to large)
The plug-in board can be divided into two groups as required:
1, 2, 3... t, | t + 1... m-1, m (1 <= t <m)
Then 1, 2, 3... t is a group
T + 1, t + 2,... s-1, m is a group
Obviously, this grouping meets the requirements. In this m, there are a total of Systems 1 (t with different values)
[Csharp]
# Include "stdio. h"
_ Int64 fun (_ int64 m ,__ int64 n)
{
_ Int64 s = 1, I;
For (I = 1; I <= m; I ++)
S = s * (n-I + 1)/I; // equal to c (n, m );
Return s;
}
Int main ()
{
_ Int64 n, I, sum;
While (scanf ("% I64d", & n )! = EOF & n)
{
Sum = 0;
For (I = 2; I <= n; I ++)
Sum + = (I-1) * fun (I, n );
Printf ("% I64d \ n", sum );
}
Return 0;
}