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]