Advertisement
istinishat

(a/b)%MOD

Jul 2nd, 2017
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int bigmod(long long a,long long p)
  2. {
  3.     long long ret = 1;
  4.     while(p) {
  5.         if(p & 1) ret = ret * a % mod;
  6.         a = a * a % mod;
  7.         p >>= 1;
  8.     }
  9.     return ret;
  10. }
  11.  
  12. (a/b)%MOD = mod_mul(a,bigmod(b,MOD-2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement