Canadian Computing Competition: 2009 Stage 1, Senior #1
Eric likes interesting numbers like . It turns out that
is both a square and a cube, since
and
. Eric calls these numbers cool. Write a program that helps Eric figure out how many integers in a given range are cool.
Input Specification
On the first line of input, you are given an integer such that
and
. On the second line of input, you are given an integer
such that
and
.
Output Specification
The output should be the number of cool numbers in the range to
(inclusively: that is,
and
would count as cool numbers in the range if they were actually cool).
Sample Input 1
1
100
Sample Output 1
2
Sample Input 2
100
1000
Sample Output 2
1
Comments
Bro I almost got this but it always exceeds my time limit.
The amount of cool numbers from 1 to 100000000 isn't big. Try pre-computing all the cool numbers.