import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
public class Main {
public static void main(String[] args) throws IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
StringBuffer sb = new StringBuffer("");
String m = "";
HashSet<Integer> set=new HashSet<Integer>();
for(int i=0;i*i<100001;i++){
set.add(i*i);
}
while(true) {
String []str=br.readLine().split(" ");
int i=Integer.parseInt(str[0]);
int j=Integer.parseInt(str[1]);
if(i==0 &&j==0)
break;
int counter=0;
for(int ind=i;ind<j+1;ind++){
if(set.contains(ind)){
counter++;
}
}
sb.append(counter).append("\n");
}
System.out.print(sb);
}
}
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
public class Main {
public static void main(String[] args) throws IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
StringBuffer sb = new StringBuffer("");
String m = "";
HashSet<Integer> set=new HashSet<Integer>();
for(int i=0;i*i<100001;i++){
set.add(i*i);
}
while(true) {
String []str=br.readLine().split(" ");
int i=Integer.parseInt(str[0]);
int j=Integer.parseInt(str[1]);
if(i==0 &&j==0)
break;
int counter=0;
for(int ind=i;ind<j+1;ind++){
if(set.contains(ind)){
counter++;
}
}
sb.append(counter).append("\n");
}
System.out.print(sb);
}
}
No comments:
Post a Comment