Cod sursa(job #2116728)
Utilizator | Data | 27 ianuarie 2018 21:43:59 | |
---|---|---|---|
Problema | Numarare triunghiuri | Scor | 0 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
var a:array [1..800] of integer;
i, n, j, l, k:integer;
f, g:text;
begin assign(f, 'nrtri.in');
assign(g, 'nrtri.out');
reset(f); rewrite(g);
read(n);
k:=1;
For i:=1 to n do read(a[i]);
For i:=1 to n-2 do
For j:=i+1 to n-1 do
For l:=j+1 to n do
if (a[i]+a[j]>=a[l]) and (a[j]+a[l]>=a[i]) and (a[l]+a[i]>=a[j]) then k:=k+1;
write(g, k);
close(f); close(g);
end.