TouchStone
  Please Login
Login Sign Up
距离明年CSP第一轮: ??天 距离CSP第二轮: ??天 距离NOIP还有: ??天
 Homepage  Problem Set  Examinations  Submissions  Discussions  Statistics
  • Home
  • Problem Set
  • P4051
  • Problem
  • P4051组合数取模
    Limits : Time Limit : - MS   Memory Limit : 65536 KB
    Judgment Tips : 1s
    Description

    计算C(n,m) mod p
    p是质数且      1<p<10^9
    1 <= m <= n <= 10^9

    Input Format

    一行,三个整数n,m和p

    Output Format

    一行,一个整数,表示所求结果

    Sample Input 1

    5 2 3

    Sample Output 1

    1

    Sample Input 2

    5 2 61

    Sample Output 2

    10

    Hint

    数据保证 min(n,m,p)\(\leq10^6\)