Product

TimeLimit:5000MS  MemoryLimit:524288KB
64-bit integer IO format:%I64d
Special Judge
未提交 | 登录后收藏
Problem Description
You are given a prime $p$. For a number $a$, you need to find positive integers $x_1, x_2, \dots, x_k$ such that $\prod x_i \equiv a \pmod p$, and $\sum x_i\leq 2500$. Output any valid solution.
Input
The first line contains a prime $p (1\leq p \leq 10^{18})$, $p$ is chosen uniformly and randomly from $[0.9\times 10^{18}, 10^{18}]$.

The second line contains a integer $q (1\leq q\leq 100)$. Each line of the following $q$ lines contains an integer $a (1\leq a\leq p-1)$, $a$ is chosen from $[1, p-1]$ uniformly and randomly.
Output
Output $q$ lines for each number. In each line, prine $k$ first, then $x_1, x_2, \dots, x_k$.
SampleInput
178187
3
6
100
109065
SampleOutput
2 2 3
1 100
2 1000 1000
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: