878. XOR-Equation B

We use x⊕y for the bitwise XOR of x and y.
Define the XOR-product of x and y, denoted by x⊗y, similar to a long multiplication in base 2, except that the intermediate results are XORed instead of the usual integer addition.

For example, 7⊗3=9, or in base 2, 1112⊗112=10012:

⊗1111112⊗1111112⊗1111112⊕1111129⊗1110012

We consider the equation:

(a⊗a)⊕(2⊗a⊗b)⊕(b⊗b)=k.

For example, (a,b)=(3,6) is a solution to this equation for k=5.

Let G(N,m) be the number of solutions to those equations with k≤m and 0≤a≤b≤N.

You are given G(1000,100)=398.

Find G(1017,1000000).

878. 异或方程 2

我们记 x⊕y 为 x 与 y 按位异或的结果。

我们定义 x 与 y 的 异或乘积 x⊗y 如下:在列竖式进行二进制乘法时,其他步骤不变,只在最后得出结果时,将算出的每一列中的数字进行异或,而非原来的二进制加法。

例如,7⊗3=9。或将此等式表示为二进制为 1112⊗112=10012。其计算过程如下:

⊗1111112⊗1111112⊗1111112⊕1111129⊗1110012

考虑方程:

(a⊗a)⊕(2⊗a⊗b)⊕(b⊗b)=k

例如,k=5 时,(a,b)=(3,6) 是原方程的一组解。

记 G(N,m) 为该方程满足 k≤m、0≤a≤b≤N 的解的数量。已知 G(1000,100)=398。

求 G(1017,1000000)。


点 这个链接 回到源站。

点 这个链接 回到详细版题目目录。