I can’t figure out a case where this solution is wrong
put this line in for loop
a+=mmin;
and remove a+=mmin*i;
(mmin * i) is overflowing
2 Likes
It worked thanks a lot…why was it overflowing? isn’t the net result the same ?
you need to typecast otherwise.
https://www.codechef.com/viewsolution/28535119
here’s my solution on as to how i avoided it
1 Like
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.
2 Likes