We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
a_len = len(a)
a = int(a, 2)
b = int(b, 2)
p = (int)(1e9+7)
res = 0
for i in range(a_len):#last is a_len
res += (a^( b << i))
res %= 10**9+7
res += (a * (314160 - a_len)) % p
res_2 = b * pow(2, a_len) * (pow(2, 314160-a_len,p)-1)
return (res + res_2)%p
Xor and Sum
You are viewing a single comment's thread. Return to all comments →
def xorAndSum(a, b):