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){}
}
}

2.

/**
* 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 Benjamin Vogt
* @author Sebastian Stumpf
* @version 1.0, 11/04/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.104
*/

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


public class Main
{
public static void main(String[] args) throws IOException
{
int small;
int big;
int sq1;
int sq2;
int max = 0;
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tokenizer = new StringTokenizer(reader.readLine());
small = Integer.valueOf(tokenizer.nextToken());
big = Integer.valueOf(tokenizer.nextToken());

while(true)
{
try
{
if(small >0 && big<=100000)
{
sq1 = (int) Math.sqrt(small-1);
sq2 = (int) Math.sqrt(big);
System.out.println(sq2-sq1);

}
max++;
tokenizer = new StringTokenizer(reader.readLine());
small = Integer.valueOf(tokenizer.nextToken());
big = Integer.valueOf(tokenizer.nextToken());
if(max == 201 || (small == 0 && big == 0))
System.exit(0);
}
catch(Exception e)
{
}
}
}
}

----------------------------------------


1.

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 11461 - Square Numbers
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=26&page=show_problem&problem=2456
*
* @author Evgeni Pavlidis
* @version 1.0, 06/02/2010
*
* Method : Precalculation - Look up table
* Status : Accepted
* Runtime: 0.008
*/

#include <iostream>
using namespace std;

#define MAX 100000

int main()
{
int table[MAX+1];

int j,c;
for(int i = 0; i <= MAX; i++)
table[i] = 0;

for(int i = 1; i*i <= MAX; i++)
table[i*i] = 1;

c = 0;
for(int i = 1; i <= MAX; i++)
{
if(table[i] == 1)
c++;
table[i] = c;
}

int a,b;

while(true)
{
cin >> a >> b;
if(a == 0 && b == 0)
return 0;

cout << (table[b] - table[a-1]) << endl;
}
}