简单题,判断区间的平方数个数:
{
Author:wzx961008
Problem:UVa 11461-Square Numbers
Verdict:Accepted
Language:PASCAL
Run Time:0.028s
Submission Date:2011-02-11 05:31:21
}
var a,b,i,ans:longint;
f:array[1..100000]of -1..1;
begin
while not eof do begin
readln(a,b);
if (a=0)and(b=0) then break;
ans:=0;
for i:=a to b do begin
if f[i]=0 then if sqrt(i)=trunc(sqrt(i)) then f[i]:=1
else f[i]:=-1;
if f[i]=1 then inc(ans);
end;
writeln(ans);
end;
end.