daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Jan 16th, 2014 344 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. LL mult(LL a, LL b, LL c)
  2. {
  3.         if (a < b) swap(a, b);
  4.         LL r = 0, m = a;
  5.         for (int i = 0; i < 64; ++i)
  6.         {
  7.                 if ((1LL<<i) > b) break;
  8.                 if (b&1LL<<i) r = (r+m)%c;
  9.                 m = (m*2)%c;
  10.         }
  11.         return r;
  12. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top