Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef long long ll;
- typedef long double dbl;
- ll mul( ll a, ll b, ll m )
- {
- ll k = (ll)((dbl)a * b / m);
- ll r = a * b - m * k;
- while (r < 0)
- r += m;
- while (r >= m)
- r -= m;
- return r;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement