当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5648:DZY Loves Math

题目描述
DZY loves math since he was very young. One day he meets this problem:

Calculate $\sum_{1\le i\le n} \sum_{1\le j \le m} \gcd(i \text{ AND } j, i \text{ OR } j)$。$\gcd(a,b)$ means the greatest common divisor of $a,b$. When $a\neq 0$, define $\gcd(0,a)=a$。AND, OR means bitwise and, or operation.

DZY says he has been tired of such kind of problems, so he leaves it to you.
输入解释
First line contains $t$, meaning there are $t$ testcases.

$t$ testcases follow. Each testcase has a line containing two integers $n,m$.

($1\le t \le 3,1\le n,m \le 15000$. There are at most $2$ testcases such that $\max\{n,m\}>2000$. There are at most $1$ testcase such that $\max\{n,m\}>8000$)
输出解释
Output the answer in one line for each testcase.
输入样例
3
3 5
30 50
210 15000
输出样例
43
15467
2660805398
来自杭电HDUOJ的附加信息
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5648

最后修改于 2020-10-25T23:24:29+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 262144/262144K(Java/Others)