#P8778. [蓝桥杯 2022 省 A] 数的拆分

    ID: 9696 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>2022数论素数判断,质数,筛法蓝桥杯省赛

[蓝桥杯 2022 省 A] 数的拆分

Problem Description

Given TT positive integers aia_i, for each aia_i determine whether it can be written in the form x1y1x2y2x_1^{y_1} \cdot x_2^{y_2}, where x1,x2x_1, x_2 are positive integers, and y1,y2y_1, y_2 are integers with y12y_1 \ge 2 and y22y_2 \ge 2.

Input Format

The first line contains an integer TT, representing the number of queries.

The next TT lines each contain a positive integer aia_i.

Output Format

For each query, if aia_i can be written in the form described in the statement, output yes; otherwise output no.

7
2
6
12
4
8
24
72
no
no
no
yes
yes
no
yes

Hint

Sample Explanation

The 44th, 55th, and 77th numbers can be written as:

$$\begin{aligned} &a_{4}=2^{2} \times 1^{2} ; \\ &a_{5}=2^{3} \times 1^{2} ; \\ &a_{7}=2^{3} \times 3^{2} 。 \end{aligned}$$

Constraints and Notes

For 10%10\% of the testdata, 1T200,ai1091 \leq T \leq 200, a_i \leq 10^{9}.

For 30%30\% of the testdata, 1T300,ai10181 \leq T \leq 300, a_i \leq 10^{18}.

For 60%60\% of the testdata, 1T10000,ai10181 \leq T \leq 10000, a_i \leq 10^{18}.

For all testdata, 1T100000,1ai10181 \leq T \leq 100000, 1 \leq a_i \leq 10^{18}.

Lanqiao Cup 2022 Provincial Contest, Group A, Problem I.

Translated by ChatGPT 5