|
||||||||||
What is N?Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2249 Accepted Submission(s): 650 Problem Description ¡¡¡¡(This problem is really old&easy and any acmer who is good at math may solve it in second) ¡¡¡¡As we know, math is both intangible and specific. Today you are going to solve the following math problem: ¡¡¡¡Given one non-negative integer b, one positive number P and one positive integer M, how many n could you find to satisfy the following 2 rules? ¡¡¡¡Here n! means n factorial , 0!=1,1!=1,2!=2,3!=6¡,n!=(n-1)!*n Input In the first line of the input , we have one integer T indicating the number of test cases. (1 <= T <= 20) Then T cases follows. For every case, only 3 integers (b, P and M) in a single line. ( 0<=b<P, 1<=P<=10^5, 1 <= M <=2^64 ¨C 1 ) Output ¡¡¡¡For each test case, first you should print "Case #x: " in a line, where x stands for the case number started with 1. Then one integer indicates the number of "n" that you can find. Sample Input
Sample Output
Source | ||||||||||
|