

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
var a:array[1..1000000] of longint;
i,n,tg,j,m:longint;
function cp(x:longint):boolean;
begin
cp:=true;
if x<0 then cp:=false;
if x>=0 then
if sqrt(x)=trunc(sqrt(x)) then cp:=true else cp:=false;
end;
begin
read(n); writeln;
for i:=1 to n do read(a[i]); writeln;
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
tg:=a[i];
a[i]:=a[j];
a[j]:=tg;
end;
for i:=1 to n do
begin
write(a[i],' ');
end; writeln;
for i:=1 to n do
if cp(a[i]) then write(a[i],' '); writeln;
m:=-10000000;
for i:=1 to n do
if (a[i]>m) and (a[i]<0) then m:=a[i];
write(m);
readln
end.
Hãy giúp mọi người biết câu trả lời này thế nào?
var j,max,i,n,m:longint;
a:array[1..32000]of longint;
function cp(n:longint):boolean;
begin
if sqrt(n)=trunc(sqrt(n)) then cp:=(true);
cp:=(false);
end;
begin
assign(input,'dayso.inp');reset(input);
assign(output,'dayso.out');rewrite(output);
read(n);
for i:=1 to n do
read(a[i]);
max:=a[1];
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
m:=a[i];
a[i]:=a[j];
a[j]:=m;
end;
for i:=1 to n do
write(a[i],' ');
writeln;
for i:=1 to n do
if cp(a[i]) then write(i,' ');
writeln;
for i:=1 to n do
if a[i]<0 then
if (max<a[i]) then max:=a[i];
write(max);
end.
Hãy giúp mọi người biết câu trả lời này thế nào?
![]()
Bảng tin