-
Notifications
You must be signed in to change notification settings - Fork 3
/
CCC09S1.java
31 lines (29 loc) · 947 Bytes
/
CCC09S1.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.StringTokenizer;
/**
* CCC '09 S1 - Cool Numbers
* Question type: Simple Math
* 5/5 on DMOJ
* @author Tommy Pang
*/
public class CCC09S1 {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st;
public static void main(String[] args) throws IOException{
int a = Integer.parseInt(br.readLine());
int b = Integer.parseInt(br.readLine());
int cnt = 0;
long sqrt = (long) Math.sqrt(b);
long cbrt = (long) Math.cbrt(b);
for (long i = (long) Math.sqrt(a); i <= sqrt; i++) {
for (long j = (long) Math.cbrt(a); j <= cbrt; j++) {
if(i * i == j * j * j)
cnt+=1;
}
}
System.out.println(cnt);
}
}