Pagini recente » Diferente pentru problema/parcare2 intre reviziile 6 si 7 | Diferente pentru problema/kbubblesort intre reviziile 2 si 1 | Monitorul de evaluare | Monitorul de evaluare | Cod sursa (job #1168766)
Program triunghiuri;
var V : array [1..900] of longint;
b1,b2 :array[0..1 shl 17 ] of char;
n,i,l,j,m : longint;
begin
assign(input,'nrtri.in'); settextbuf(input,b1); reset(input);
assign(output,'nrtri.out'); settextbuf(output,b2); rewrite(output);
readln(n); l:=0;
for i:=1 to n do read(V[i]);
for i:=1 to n-2 do
for j:=i+1 to n-1 do begin
m:=j+1;
while (V[m]<=(V[i]+V[j])) and (m<=n) do
begin
l:=l+1;
m:=m+1;
end;
end;
writeln(l);
close(input);
close(output);
end.