#P4446. [AHOI2018初中组] 根式化简
[AHOI2018初中组] 根式化简
Description
While learning about cube roots, Keke encountered the following problem:
Simplify the following radicals to their simplest forms:
(1) (2) (3)
This was too easy for Keke, and he quickly got the answers:
(1) (2) (3)
Keke knows that any radical of the form can be simplified to the simplest form . He found this interesting and created many similar problems, but soon got overwhelmed, so he asked you for help:
Given radicals of the form , simplify each to the simplest form . For convenience, you only need to output .
If you have not learned this topic, you can think of it as: given positive integers , for each , find integers such that , and output the largest integer .
Input Format
The input has two lines:
- The first line contains an integer , the number of radicals of the form .
- The second line contains positive integers, giving each in order.
Output Format
Output lines, each with a positive integer. The -th line contains the answer for the -th in the input.
3
125 81 52
5
3
1
Hint
For of the testdata: , .
There are 10 test points, numbered , with the following additional guarantees:
1 ~ 2: , .
3 ~ 4: , .
5 ~ 6: , and is a perfect cube.
7 ~ 8: , .
9 ~ 10: , .
Translated by ChatGPT 5
京公网安备 11011102002149号