#P6250. 分拆
分拆
Description
Little W defines a kind of “good partition”:
For a positive integer , if there exist integers such that , then is called “good”, and is a “good partition” of .
Now, Little W gives you some . He wants you to determine whether each is “good”. If it is good, output any “good partition” of .
Input Format
The first line contains an integer , indicating the number of test cases.
The next lines each contain an integer , representing one query from Little W.
Output Format
For each test case, output several lines.
If is not “good”, output only one line NO.
Otherwise, output YES in the first line. Then output one integer in the next line, meaning how many different values appear in your “good partition”. In the next lines, output two integers , meaning there are occurrences of .
3
1
2
5
YES
1
1 1
NO
YES
3
1 5
2 1
2 -1
Hint
Sample Explanation
When , is a “good partition” of .
When , has no “good partition”.
When , $5+1+1+(-1)+(-1)=5\times1\times1\times(-1)\times(-1)=5$, so is a “good partition” of .
Constraints
This problem is not bundled for judging.
: ;
: ;
: .
For all testdata, .
Notes
This problem uses .
A test point gets full score if and only if, for all test cases in that test point:
- The answer in the first line is the same.
- If the answer in the first line is
YES, it must also satisfy , , .
To make it easier to write the , it is allowed that some are the same. Also, please make sure there is one and only one newline at the end of the output file.
For the source code, please see the Cloud Clipboard.
Translated by ChatGPT 5
京公网安备 11011102002149号