Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ll mul (ll a, ll b, ll m) {
- ll res = 0;
- a %= m;
- while (b > 0) {
- if (b % 2) res = (res + a) % m;
- a = (a * 2) % m;
- b /= 2;
- }
- return res % m;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement