問題一覧 > 通常問題

No.3377 Sigma Index × A Problems

レベル : / 実行時間制限 : 1ケース 3.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 25
作問者 : 👑 loop0919 / テスター : lif4635 Iroha_3856
お気に入りにしたユーザー ProblemId : 12760 / 自分の提出
問題文最終更新日: 2026-01-07 22:45:55
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 489 (順位表) の他の問題:

Problem Statement

The problem setter, loop0919, came up with the following problem.

Index × A Problem:

You are given positive integers $l, r ~ (l \leq r)$.
Find the maximum length of a sequence $A$ satisfying all of the following conditions.

  • Each element of $A$ is an integer between $l$ and $r$, inclusive.
  • $i \times A_i ~ (1 \leq i \leq |A|)$ is constant.

However, loop0919 thought that this problem might have appeared before, and decided to modify it as follows.

Sigma Index × A Problems:

You are given a positive integer $N$.
Define $f(l, r)$ as the answer to the Index × A Problem for this $l, r$.

Find $\displaystyle \sum_{l = 1}^N \sum_{r = l}^N f(l, r)$ modulo $998244353$.

You are given a positive integer $N$. Find the answer to the Sigma Index × A Problems for this $N$.

You are given $T$ test cases; solve each of them.

Constraints

  • $1 \leq T \leq 10^5$
  • Each test case satisfies all of the following constraints.
    • $1 \leq N \leq 10^{17}$
  • All input values are integers.

Input

The input is given from Standard Input in the following format, where $\mathrm{case}_t ~ (1 \leq t \leq T)$ represents the $t$-th test case.

$T$
$\mathrm{case}_1$
$\mathrm{case}_2$
$\vdots$
$\mathrm{case}_T$

Each test case is given in the following format.

$N$

Output

Print $T$ lines. The $t$-th line should contain the answer to the $t$-th test case.

Sample

Sample 1
Input
5
3
16
256
1000000007
31415926535897932
Output
8
247
77323
452669419
124925574

For the $1$-st test case, the following holds.

  • $f(1, 1) = 1$. For example, the sequence $A = (1)$ of length $1$ satisfies the conditions in the Index × A Problem.
  • $f(1, 2) = 2$. For example, the sequence $A = (2, 1)$ of length $2$ satisfies the conditions in the Index × A Problem.
  • $\vdots$

Calculating in this way, it can be shown that $\displaystyle \sum_{l = 1}^N \sum_{r = l}^N f(l, r) = 8$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。