#P4397. [JLOI2014] 聪明的燕姿

    ID: 3312 远端评测题 2000ms 128MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>2014各省省选吉林枚举,暴力素数判断,质数,筛法

[JLOI2014] 聪明的燕姿

Description

In the city, people always hold number tickets, keep searching, and keep matching, yet no one knows whom they are waiting for.

But Yanzi is different. Yanzi knows whom she is waiting for, because she is good at math. Yanzi discovered a magical algorithm: suppose the number on her ticket is SS, then the sum of all positive divisors of the number on the other person's ticket must equal SS.

So Yanzi always searches through subways and crowds holding her number ticket to find numbers (Hey! Is this really reliable?), but she is busy singing "Green Light" and wants to ask you to write a program to quickly find everyone she is waiting for.

Input Format

The input contains kk test cases.

For each test case, the input consists of a single integer SS.

Output Format

For each test case, output two lines. The first line contains an integer mm, denoting there are mm people she is waiting for.

The second line contains the corresponding mm numbers, which are the number tickets of all those people.

In particular, when m=0m=0, i.e., no number satisfies the requirement, that test case should not output the second line (only output the single line 00).

Note: The numbers you output must be in ascending order.

42
3
20 26 41

Hint

For 100%100\% of the testdata, k100k \leqslant 100, S2×109S \leqslant 2 \times 10^9.

Translated by ChatGPT 5