#C1550. Numbers That Are Both Perfect Squares and Cubes
Numbers That Are Both Perfect Squares and Cubes
Numbers That Are Both Perfect Squares and Cubes
This problem requires you to find all numbers in a given interval [\(\text{start}\), \(\text{end}\)] (inclusive) that are both perfect squares and perfect cubes. A number that is both a perfect square and a perfect cube is actually a perfect sixth power, i.e., there exists an integer \(x\) such that \(n = x^6\). Note that if \(0\) is in the interval, it should be considered as a valid perfect square and cube.
Input: Two integers representing the start and end of the interval.
Output: A list of numbers (in increasing order) that satisfy the condition, printed on a single line separated by spaces. If no such numbers exist, print an empty line.
inputFormat
The input consists of two integers (\text{start}) and (\text{end}) separated by whitespace, representing the inclusive range [start, end] in which to search for numbers that are perfect squares and perfect cubes.
outputFormat
Output the numbers that are both perfect squares and perfect cubes within the interval, separated by a single space. If there are no such numbers, output an empty line.## sample
1 100
1 64
</p>