|
||||||||||
Solve the puzzle, Save the world!Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 320 Accepted Submission(s): 223 Problem Description In the popular TV series Heroes, there is a tagline "Save the cheerleader, Save the world!". Here Heroes continues, "Solve the puzzle, Save the world!". Finally, alien invaders visit our planet. They are eccentric and launch attack many rounds. Since trust in prime numbers, each round they send out p killers, here p is a prime number. Countries on our planet unite and assemble an armed troop of n population. And fortunately we get a fatal weakness of enemy from a betrayer. If the ways of choosing m warriors from n is a multiple of p, the killer number, we will win. Otherwise, we will lose. As the greatest programmer of our planet, you are invited to write a program to count the number of m(0¡Üm¡Ün) such that C(n, m) is a multiple of prime p. Input Each line will contain an integer n(1¡Ün¡Ü10^5) and a prime p(2¡Üp<10^7), separated by a single space. Process to the end of file. Output For each test of case, if the world can be saved, output the number of ways, otherwise, output "Where is hero from?"(without quotation), both on a single line. Sample Input
Sample Output
Source | ||||||||||
|