mirror of
https://github.com/Hizenberg469/Algorithms-snippets.git
synced 2026-04-20 07:02:23 +03:00
Graph, Number Theory, String Hashing Algo added
This commit is contained in:
9
Number Theory/Fast_Multiply.cpp
Normal file
9
Number Theory/Fast_Multiply.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user