Hdu 2200 Eddy's AC (Mathematics)

Source: Internet
Author: User

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;
}

Related Article

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.