760. Sum over Bitwise Operators

Define

g(m,n)=(m⊕n)+(m∨n)+(m∧n)

where ⊕,∨,∧ are the bitwise XOR, OR and AND operator respectively. Also set

G(N)=∑n=0N∑k=0ng(k,n−k)

For example, G(10)=754 and G(102)=583766.

Find G(1018). Give your answer modulo 1000000007.

760. 位运算求和

记

g(m,n)=(m⊕n)+(m∨n)+(m∧n)

其中 ⊕,∨,∧ 分别指按位异或、按位或、按位与运算。

另记

G(N)=∑n=0N∑k=0ng(k,n−k)

例如有 G(10)=754、G(102)=583766。

求 G(1018) 模 1000000007 的值。


点 这个链接 回到源站。

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