From geeksforgeeks i found (a * b) % m = ((a % m) * (b % m)) % m
also (a / b) % m may NOT be same as ((a % m)/(b % m)) % m
Last edited on
( x / y ) % m = ( ( x % m ) * power( y , m-2 ) )%m
i think you can solve ( ( a*b )/2 ) % m.
thanks a lot that definitely helped me
@iotaa
Are you trying to solve Chef an Ingredients
@Dum You solved chef an ingredients ? I am getting a WA in 1 sub task . Can you help me out with that test case ?
@TheTimes No
i am also getting 1 case wrong.