P9821 [ICPC 2020 Shanghai R] Sum of Log
题目描述
Given two non-negative integers $X$ and $Y$, determine the value of
$$ \sum_{i=0}^{X}\sum_{j=[i=0]}^{Y}[i\&j=0]\lfloor\log_2(i+j)+1\rfloor $$
modulo $10^9+7$ where
- $\&$ denotes bitwise AND;
- $[A]$ equals 1 if $A$ is true, otherwise $0$;
- $\lfloor x\rfloor$ equals the maximum integer whose value is no more than $x$.
输入格式
无
输出格式
无
说明/提示
For the first test case:
- Two $(i,j)$ pairs increase the sum by 1: $(0, 1), (1, 0)$
- Six $(i,j)$ pairs increase the sum by 2: $(0, 2), (0, 3), (1, 2), (2, 0), (2, 1), (3, 0)$
So the answer is $1\times 2 + 2\times 6 = 14$.