chef and func

what is output if -(10^11)(10^9+7)?? is it ans + (10^9+7) or ans(10^9+7)+(10^9+7)???

1 Like

This should be the answer.

I guess that is ans%MOD + MOD.

(ans%MOD+MOD)%MOD

2 Likes

what should i do when the ans is greater than 10^18 or less than -10^18.
The operator does not work for that range.... -10^21(10^9+7) = ???

1 Like

Hey once you think you are “storing” 10^21 in a variable in C/C++ then dont think you have any control over it. Basically you should focus towards avoiding it at first place.

1 Like

for ans = -mod, you formula gives mod, while the right answer is 0.

so you wanna say that ans > (10^18) would’t present in any test case??

I have checked my code, it gave right ans for over 50 test cases…
instead of that, i am getting wrong ans…what am i missing ,can anyone tell me.