mirror of
https://github.com/Hizenberg469/Algorithms-snippets.git
synced 2026-04-19 22:52:23 +03:00
Some Changes
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
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;
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int binary_multiplication(int a , int b,int M=(int)1e9+7){
|
||||
int res = 0;
|
||||
while( b ){
|
||||
if( b&1 ) res += a , res %= M;
|
||||
a = 2 * a ; a %= M:
|
||||
b >>= 1;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int main(){
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user