mirror of
https://github.com/Hizenberg469/Algorithms-snippets.git
synced 2026-04-19 22:52:23 +03:00
9 lines
124 B
C++
9 lines
124 B
C++
int fast_multiply(int a,int b,int c){
|
|
int res=0;
|
|
while(b){
|
|
if(b&1)res+=a,res%=c;
|
|
a+=a,a%=c;
|
|
b>>=1;
|
|
}
|
|
return res;
|
|
} |