Eddy's AC Problems
Time Limit: 3000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 3710 accepted submission (s): 1741
Problem descriptioneddy is an acmer. He not only enjoys ACM, but also studies the number of AC for each person in the ranklist, when he is bored, he often extracts the number of AC questions of each person on the ranklist on paper, and then selects some (or all) people from them to divide them into two groups for comparison based on the number of AC questions, he wants to make the minimum AC number in the first group greater than the maximum AC number in the second group, but there will be many such cases. Do you know how many such cases are there?
Note: to simplify the problem, we assume that the number of people in the excerpt is N, and the number of each person's AC is not equal. The final result is within the 64-bit integer range.
Input contains multiple groups of data. Each group contains an integer N, indicating the total number of extracted data from the ranklist.
Output: for each instance, the total number of solutions that meet the requirements is output. Each output occupies one row.
Sample Input
24
Sample output
117
Authoreddy idea: If you want to find the total number of types, you can select the plug-in method. There are n numbers in total, and m numbers (n> = m> = 2) are selected from them, which is equivalent to inserting boards in the M number. In total, there is a possibility of making one, from the extraction of N in the total number, M is equal to CNM = N in the permutation and combination formula! /(M! * (N-m )!); Experience: Double represents the 64-bit final use of. 0lf. Extremely comfortable. Knowledge points used: Double Variables are stored in a signed IEEE 64-bit (8 bytes) double-precision floating point number format. The negative value ranges from-1.79769313486231570e + 308 to-4.94065645841246544e-324, the value range of positive values is 4.94065645841246544e-324 to 1.79769313486231570e + 308.
The Code is as follows:
# Include <stdio. h> double C (double A) {double S = 1, I; for (I = 1; I <= A; I ++) S * = I; return s ;} double F (double N, double I) {return C (n)/(C (n-I) * C (I);} int main () {double N, i, sum; while (~ Scanf ("% lf", & N) {sum = 0; for (I = 2; I <= N; I ++) sum + = (I-1) * F (n, I); printf ("%. 0lf \ n ", sum);} return 0 ;}