Pagini recente » Cod sursa (job #3218149) | Cod sursa (job #910483) | Cod sursa (job #289521) | Cod sursa (job #2598807) | Cod sursa (job #967634)
Cod sursa(job #967634)
type tabel=array[1..1000] of longint;
var a,b:text;
n,i,tot,j,k:longint;
t:tabel;
function correct(i,j,k:longint):boolean;
var max:longint;
begin
correct:=false;
if (t[i]>t[j]) and (t[i]>t[k]) then if t[k]+t[j]>=t[i] then correct:=true;
if (t[j]>t[i]) and (t[j]>t[k]) then if t[i]+t[k]>=t[j] then correct:=true;
if (t[k]>t[j]) and (t[k]>t[i]) then if t[i]+t[j]>=t[k] then correct:=true;
end;
begin
assign(a,'nrtri.in');
reset(a);
assign(b,'nrtri.out');
rewrite(b);
read(a,n);
for i:=1 to n do
read(a,t[i]);
for i:=1 to n-2 do
for j:=i+1 to n-1 do
for k:=j+1 to n do
if (i<>j) and (j<>k) and (i<>k) then
if correct(i,j,k) then
begin
tot:=tot+1;
end;
writeln(b,tot);
close(a);
close(b);
end.