Replies: 1 comment 2 replies
-
J'obtiens 58 au lieu de 42 avec |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
int karatsuba(int x, int y, int n) {
if(x==0 || y==0)
return 0;
if(x==1)
return y;
if(y==1)
return x;
int k = n >> 1;
int a = x >> k;
int b = x-(a<<k);
int c = y >> 1;
int d = y-(c<<k);
int ac = karatsuba(a,c,k);
int bd = karatsuba(b,d,k);
return (ac<<n) + bd + ((ac+bd-karatsuba(a-b,c-d,k)) << k);
}
Beta Was this translation helpful? Give feedback.
All reactions