[HDU 2200]

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. Sample INPUT2 4 Sample Output117 This problem should be to find a regular problem, push the formula is not difficult to find the law. On the Java code.
mport Java.util.Scanner; Public classMain { Public Static DoubleSolution (intN) {DoubleRET = 0;  for(inti = 2; I <= N; i++) {ret+ = Temp (n, i) * (i-1 ); }        returnret; }     Public Static DoubleTempintNintk) {Doublem = 1; DoubleT1 =N;  for(inti = k; i > 0; i--) {m*=T1; T1--; }        Doubleo = 1;  for(inti = k; i > 1; i--) {o*=i; }        return(M/o); }     Public Static voidMain (string[] args) {//TODO auto-generated Method StubScanner sc =NewScanner (system.in);  while(Sc.hasnext ()) {intn =Sc.nextint (); System.out.println ((Long) main.solution (n)); }    }}

[HDU 2200]

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.