問題一覧 > 通常問題

No.3776 Magic Square of Product

レベル : / AI推定難易度 : 1100 / 実行時間制限 : 1ケース 2.500秒 / メモリ制限 : 1024 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 44
作問者 : Rapca1256 / テスター : aogera 👑 p-adic tomorunn
お気に入りにしたユーザー ProblemId : 13215 / 自分の提出
問題文最終更新日: 2026-08-22 13:23:34
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 519 (順位表) の他の問題:

Problem Statement

There is a $3\times 3$ grid, and initially nothing is written in any of its cells.
You will now write one positive integer in each cell so that all of the following conditions are satisfied.
Here, let $A_{ij}$ denote the number written in the cell that is $i+1$-th from the top and $j+1$-th from the left ( $0\le i, j < 3$ ).
・For $i=0,1,2$, $A_{i0}A_{i1}A_{i2}=K$ holds.
・For $j=0,1,2$, $A_{0j}A_{1j}A_{2j}=K$ holds.

In other words, you write the numbers so that for every group of $3$ integers aligned vertically or horizontally, their product is exactly $K$. Find the total number of ways to write the numbers in this way, modulo $998244353$.

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

Input

$T$
$case_1$
$case_2$
$case_3$
$\vdots$
$case_T$
$case_i$ is the $i$-th test case, given in the following format.
$K$

The input satisfies the following constraints.
・ All input values are integers
・ $1 \le T \le 10^5$
・ $1 \le K \le 10^6$

Output

Print $T$ lines. On the $i$-th line, print the answer to the $i$-th test case. Print a newline at the end.

Sample

Sample 1
Input
3
108
1
120
Output
1155
1
1980

For the $1$st case, for example, the numbers can be written as follows.

2 6 9
6 9 2
9 2 6

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