1.

/**
* Angewandte Mathematik, SS11
* Problem: 11461 - Square Numbers
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=26&page=show_problem&problem=2456
* @author Fabian, Trampusch
* @author Robert Schwarz
* @version 1.0, 19.04.2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.220
*/


import java.util.Scanner;


public class Main {

public static void main(String[] args) {
int m = 0;
int n = 0;
double d;
int j;
int count = 0;
boolean b = true;
Scanner sc = new Scanner(System.in);
try{
while (b) {
m = sc.nextInt();
n = sc.nextInt();
b = !(n == 0 && m == 0);
count = 0;

if(b){
for(int i = m; i <= n;i++){
d = Math.sqrt(i);
j = (int) d;
if(d == j){
count++;
}
}
System.out.println(count);
}
}
}catch(Exception e){}
}
}

.----------------------------------------------------------

1.


/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem 11461 - Square Numbers
* Link: http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=26&problem=2456&mosmsg=Submission+received+with+ID+7058391
*
* @author Andre Wolfram
* @author Christoph Miesel
* @author Robert Seilbeck
* @version 1.0, 04/08/2009
*
* Status : Accepted
* Runtime 0.160
*/


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {

/**
* @param args
* @throws IOException
* @throws NumberFormatException
*/
public static void main(String[] args) throws NumberFormatException,
IOException {
//Calculate square numbers
ArrayList<Integer> squareNumbers = new ArrayList<Integer>();
int oddNumber = 1;
int squareNumber = 0;
while (squareNumber < 100000) {
squareNumber = squareNumber + oddNumber;
squareNumbers.add(squareNumber);
oddNumber += 2;
}

BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
String line;

while ((line = reader.readLine()) != null) {
StringTokenizer st = new StringTokenizer(line, " ");

int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());

if((a+b)==0){
break;
}

//counts the square numbers in the inputed range
int startIndex = -1;
int i = 0;
for (; i <= squareNumbers.size(); i++) {
if (startIndex == -1 && a <= squareNumbers.get(i)) {
startIndex = i;
}
if (b < squareNumbers.get(i)) {
break;
}
}
if (startIndex == -1) {
System.out.println("0");
} else {
System.out.println(i - startIndex);
}
}
}

}