Eddy ' s AC puzzle--hdu2200 (Recursive)

Source: Internet
Author: User
Problem Descriptioneddy is a acmer, he not only like to do ACM problem, but also for each of the ranklist of the number of AC has a certain research, he is bored often on the paper on the ranklist of each person's AC number excerpt down, Then choose some people (or all) to compare the number of AC into two groups, he wants to make the minimum AC number in the first group is greater than the maximum AC number in the second group, but there will be a lot of, smart you know how many kinds of cases?

Special note: For the sake of simplification, we assume that the number of extracts under the excerpt is N, and that the number of AC for each person is not equal and the final result is within a 64-bit integer range.

Input inputs contain multiple sets of data, each containing an integer n representing the total number of people extracted from the ranklist.

Output for each instance, outputs the total number of scenarios that meet the requirements, one row per output.

Sample Input24

Sample Output117

The idea of recursion is still not very

I feel like I'm not going to write a blog every time I say it's not going to go down.

This problem is ana=1c (n,2) +2c (n,3) +3c (n,4) +...+ (n-1) C (n,n);

Another ans= (n-2) *pow (2,n-1) +1; (This is the idea of recursion)

Eddy ' s AC puzzle--hdu2200 (Recursive)

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.