F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

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
3 1 2 3 2 3 4 3 4 5
 

Sample Output
Case #1: 2 Case #2: 0 Case #3: 0
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-25 03:08:51, Gzip enabled