

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
uses crt;
var f:text; i,j,n,ma,s:longint; a:array[1..100]of longint;
begin
clrscr;
assign(f,'VATSUA.INP');reset(f);
readln(f,n);
for i:=1 to n do read(f,a[i]);
close(f);
assign(f,'VATSUA.OUT');rewrite(f);
s:=0;
for i:=1 to n do
begin
ma:=1;
for j:=1 to n do
if a[j]>a[ma] then ma:=j;
if a[ma]=0 then break;
s:=s+a[ma];
a[ma]:=0;
for j:=1 to n do
if a[j]<>0 then dec(a[j]);
end;
writeln(f,s);
close(f);
end.
Hãy giúp mọi người biết câu trả lời này thế nào?

uses crt;
var a:array[1..101]of LongInt ;
n,i,s:LongInt;
begin
clrscr();
readln(n);
for i:=1 to n do
begin
write(i,'=');
readln(a[i]);
end;
for i:=1 to n do
begin
a[i]:=a[i]-1;
S:=S+a[i];
end;
writeln(s);
readln
end.
Hãy giúp mọi người biết câu trả lời này thế nào?

Bảng tin

20
237
9
https://hoidap247.com/cau-hoi/3743505 helpp
20
237
9
https://hoidap247.com/cau-hoi/3750287 giang hồ cấp cíu
20
237
9
https://hoidap247.com/cau-hoi/3837653 hộ với
20
237
9
https://hoidap247.com/cau-hoi/3852548 bản full
20
237
9
giúp với