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

建议使用的浏览器:

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

6417:Rikka with APSP

题目描述
APSP (All Pair Shortest Path) is a basic problem in graph theory.

Since solving APSP for arbitrary graphs is not a simple task, Rikka wants to start with some particular graphs.

At first, Rikka has $n$ vertices without any edges. And then for each pair of vertices $(i,j)(i<j)$, Rikka links an undirected edge between them with length $f(i,j)$. The value of $f(i,j)$ is equal to the minimum positive integer $k$ which satisfies $ijk$ is a square number. (It is clear that $f(i,j)$ always exists because $ij(ij)$ must be a square number)

For example, if $n=4$, the adjacency matrix of the graph will be:
\begin{align*}
\begin{bmatrix}
/ & 2 & 3 & 1 \\
2 & / & 6 & 2 \\
3 & 6 & / & 3 \\
1 & 2 & 3 & / \\
\end{bmatrix}
\end{align*}

Let $d(i,j)$ be the length of the shortest path between vertex $i,j$. And now Rikka wants you to calculate:
$$\sum_{i=1}^n \sum_{j=i+1}^{n} d(i,j)$$
输入解释
The first line contains one single integer $t(1 \leq t \leq 50)$, the number of the testcases.

For each testcase, the first line contains exactly one integer $n(1 \leq n \leq 10^{10})$.

The input guarantees that there are at most $3$ testcases with $n > 10^{8}$.
输出解释
For each testcase, output a single integer, the answer modulo $998244353$.
输入样例
3
4
10
100
输出样例
16
243
190371
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6417

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

共提交 0

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