luogu#P8054. A 质因数
A 质因数
Problem Description
Define as the number of prime factors of after prime factorization, counting multiplicities. For example, and .
Specifically, let , where are pairwise distinct primes. Then .
Given a number , determine whether there exists an integer with such that .
Input Format
The first line contains an integer , which represents the number of test cases.
The next lines each contain a positive integer .
Output Format
Output lines. For the -th test case, if the given has some satisfying and , output a single number on one line; otherwise output a single number on one line.
6
2
3
4
5
12
514
0
0
0
1
0
1
Hint
Sample Explanation #1
, and there is no with .
, and there is no with .
, and there is no with .
, and exists.
, and there is no with .
, and exists.
Constraints
For all testdata, and . The detailed constraints are as follows:
- Subtask #1 (25 pts): .
- Subtask #2 (35 pts): .
- Subtask #3 (15 pts): , and is generated uniformly at random in .
- Subtask #4 (25 pts): No additional constraints.
Translated by ChatGPT 5