In C++, I have a problem need to calculate ((a * b * c) / n) % m
with large a, b and c (0 < a, b, c <= 10^9 and n, m > 0)
. And the problem guaranteed that a * b * c
is divisible by n
.
I tried calc ((a * b) % m * c) % m) / n
but it's not a right answer.