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

建议使用的浏览器:

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

6258:Rikka with Equation

题目描述
The conclusion of Hilbert's tenth problem shows that it's impossible to design an algorithm to calculate the integral solutions of an arbitrary equation. But for some simple equation, we can easily check it.

For example, to check if there exist two integers $x,y$ which satisfy $x^2 + y^2 = a$ and $xy =b$: We can calculate $x+y = \pm \sqrt{a+2b},x-y=\pm\sqrt{a-2b}$ and then check if both $x$ and $y$ could be integers.

Rikka thinks this task is too simple and she wants to make it look harder. Rikka knows, sometimes if you consider the equality after modulo $m$, the task will be different. So, she wants to do the same thing to this problem.

She call a tuple $(a,b,m)(0 \leq a,b < m)$ valid if and only if there exist two integers $x$ and $y$ which satisfy $x^2+y^2\equiv a \mod m, xy\equiv b \mod m$. After showing you a positive integer $n$, she wants you to calculate the number of valid tuples $(a,b,m)$ with $m \leq n$.

输入解释
The first line contains a single integer $t(1 \leq t \leq 10^5)$, the numebr of the testcases.

For each testcase, the first line contains a single number $n(1 \leq n \leq 10^7)$.
输出解释
For each testcase, output a single line with a single integer, the answer modulo $998244353$.
输入样例
5
3
5
10
100
1000
输出样例
8
22
104
45933
32791150
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6258

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

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 512000/512000K(Java/Others)