pllk / cphb

Competitive Programmer's Handbook
2.94k stars 354 forks source link

Overflow modpow #55

Closed darbula closed 7 years ago

darbula commented 7 years ago

In this line

u = (u*u)%m;

u is int so it could overflow.