P4397 [JLOI2014] Smart Yanzi
Background
> Outside the car window on a cloudy evening.
>
> Someone is waiting in the future.
>
> Look left, right, and forward.
>
> Love takes a few turns before it arrives.
>
> Whom will I meet, and what kind of conversation will we have.
>
> How far in the future is the one I'm waiting for.
>
> I hear the wind coming from the subway and the sea of people.
>
> I stand in line holding a number for love.
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 $S$, then the sum of all positive divisors of the number on the other person's ticket must equal $S$.
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 $k$ test cases.
For each test case, the input consists of a single integer $S$.
Output Format
For each test case, output two lines. The first line contains an integer $m$, denoting there are $m$ people she is waiting for.
The second line contains the corresponding $m$ numbers, which are the number tickets of all those people.
In particular, when $m=0$, i.e., no number satisfies the requirement, that test case should not output the second line (only output the single line $0$).
Note: The numbers you output must be in ascending order.
Explanation/Hint
For $100\%$ of the testdata, $k \leqslant 100$, $S \leqslant 2 \times 10^9$.
Translated by ChatGPT 5