bài 1:
uses crt;
var a:array[1..100]of integer;
i,n,max,dem,j,vt:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{------------------------------------}
for i:=1 to n do write(a[i]:4);
{-------------xu-ly----------------------}
writeln;
max:=0;
for i:=1 to n-1 do
if sqrt(a[i])=trunc(sqrt(a[i])) then
begin
dem:=1;
for j:=i+1 to n do
begin
if sqrt(a[j])=trunc(sqrt(a[j])) then inc(dem);
if (j=n) and (max<=dem) and (sqrt(a[j])=trunc(sqrt(a[j]))) then
begin
max:=dem;
vt:=j;
end;
if (sqrt(a[j])<>trunc(sqrt(a[j]))) then if (max<=dem) then
begin
max:=dem;
vt:=j-1;
break;
end
else break;
end;
end;
if max=0 then writeln('ko co')
else begin
writeln('doan co so chinh phuong dai nhat la: ',max);
writeln('o vi tri tu ',vt-max+1,' den ',vt);
end;
readln;
end.