编程介的小学生 2020-01-05 21:58 采纳率: 20.5%
浏览 205

Solve the puzzle, Save the world!

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
6 2
5333 127
100000 11

Sample Output
3
Where is hero from?
92301

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 扩散模型sd.webui使用时报错“Nonetype”
    • ¥15 stm32流水灯+呼吸灯+外部中断按键
    • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
    • ¥15 NX MCD仿真与博途通讯不了啥情况
    • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
    • ¥15 gradio的web端页面格式不对的问题
    • ¥15 求大家看看Nonce如何配置
    • ¥15 Matlab怎么求解含参的二重积分?
    • ¥15 苹果手机突然连不上wifi了?
    • ¥15 cgictest.cgi文件无法访问