Pagini recente » Cod sursa (job #1921295) | Cod sursa (job #1882398) | Cod sursa (job #1461289) | Cod sursa (job #865005) | Cod sursa (job #1131839)
Program triunghiuri;
var V : array [1..900] of longint;
n,i,l,j,k : longint;
procedure swap ( var x,y : longint);
var aux : longint;
begin
aux:=x;
x:=y;
y:=aux;
end;
begin
assign(input,'nrtri.in'); reset(input);
assign(output,'nrtri.out'); 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
for k:=j+1 to n do
if (V[k]<=V[j]+V[i]) and (V[k]>=V[j]-V[i])
then l:=l+1;
writeln(l);
close(input); close(output);
end.