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

建议使用的浏览器:

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

7117:Easy Math Problem

Special Judge 特殊评判
题目描述
Kanari recently worked on perfect numbers.

Perfect numbers are a special kind of natural numbers. A number is a perfect number if and only if the sum of all the true factors (divisors other than itself) is equal to itself. Such as $6=1+2+3$, $28=1+2+4+7+14$, etc.

Kanari made a kind of semi-perfect number of his own according to the definition of perfect number.

Let $S$ be the set of all the true factors of the natural number $X$. If there is a subset of $S$ such that the sum of the numbers in the subset is equal to the number itself, the number is said to be semi-perfect.

Obviously, all perfect numbers are semiperfect numbers. In addition, there are some numbers that are not perfect, and they also belong to Kanari's semi-perfect numbers. For example, the true factors set of $24$ is $\{1,2,3,4,6,8,12\}$, we can select a subset $\{2,4,6,12\}$, meet that $24=2+4+6+12$. So $24$ can be called a semi-perfect number.

Kanari wants to know if he can find an integer $k$ which is a multiple of positive integer $p$, such that $k$ is a semi-perfect number.

Since Kanari is not good at math, he wants the $k$ not to be too large ($k\leq 2\times 10^{18}$), and the size of the subset is not larger than 1000. He wants you to give the subset you select.
输入解释
This problem contains multiple test cases.

The first line contains a single integer $T$ ($1\leq T\leq 4000$) indicating the number of test cases.

Then $T$ cases follow, each of which contains a single interger $p$ ($1\leq p\leq 10^9$).
输出解释
Output $2T$ lines.

For each test case, if there is some integer $k$ that satisfy the condition, output two space-separated integers on the first line, $k$ ($k\leq 2\times 10^{18}$) and $n$ ($1 \leq n \leq 1000$) (the size of the subset you select). Then output $n$ space-separated integers on the second line, the subset you select.

If you cannot find such $k$, output "-1" on the first line, and an empty line on the second line.

Please don't output extra space at the end of each line.
输入样例
2
6
1
输出样例
48 5
2 4 6 12 24
12 4
1 2 3 6

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

源链接: HDU-7117

最后修改于 2021-10-23T19:11:34+00:00 由爬虫自动更新

共提交 0

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