I can’t figure out a case where this solution is wrong
put this line in for loop
and remove a+=mmin*i;
(mmin * i) is overflowing
It worked thanks a lot…why was it overflowing? isn’t the net result the same ?
you need to typecast otherwise.
here’s my solution on as to how i avoided it
You have overflow due to mmin being int. so i*mmin might be overflowing as i can be as large as 10^6 and A can be as large as 10^9 so 10^15
Here is your code, i corrected for these (typcasted during multiplication ) and it is getting AC.