Yes, I know that the question may seem naive, but I searched a lot on Google and on this site, but could not find a satisfactory answer to it. I just want to calculate (A * B)% MOD, assuming a is long long, as well as b and MOD. Suppose that MOD is greater than A and B, such that A% MOD = A and B% MOD = B, but A * B is greater than 64 bits. How can I fix the value (A * B)% MOD?
c ++ math modulo multiplication
unrealsoul007
source share