Pagini recente » Cod sursa (job #3137140) | Cod sursa (job #1375992) | Cod sursa (job #166622) | Cod sursa (job #2869032) | Cod sursa (job #96521)
Cod sursa(job #96521)
var
fi, fo : text;
i, j, n, aux, nt, l12, k : longint;
a : array[1..800] of integer;
begin
assign(fi,'nrtri.in'); reset(fi);
assign(fo,'nrtri.out'); rewrite(fo);
readln(fi,n);
for i := 1 to n do
read(fi,a[i]);
for i := 1 to n-1 do
for j := i+1 to n do
if a[i] > a[j] then
begin
aux := a[i]; a[i] := a[j]; a[j] := aux;
end;
{ for i := 1 to n-2 do
for j := i+1 to n-1 do
begin
k := j+1; l12 := a[i]+a[j]; // suma lungimilor primelor 2 segmente
while (l12 >= a[k]) and (k <= n) do
begin
inc(nt); inc(k)
end;
end;}
write(fo,nt);
close(fi); close(fo);
end.