Cod sursa(job #120191)
Utilizator | Data | 4 ianuarie 2008 15:33:44 | |
---|---|---|---|
Problema | Medie | Scor | 40 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.6 kb |
var v:array[1..9000]of longint;
x,y,m:array[1..7000]of longint;
i,j,n,s,max:longint;
begin
assign(input,'medie.in');reset(input);
assign(output,'medie.out');rewrite(output);
readln(n);
for i:=1 to n do
begin
read(v[i]);
inc(x[v[i]]);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
begin
if (v[i]+v[j]) mod 2=0 then
inc(y[(v[i]+v[j]) div 2]);
end;
for i:=1 to n do
if y[v[i]]<>0 then
s:=s+y[v[i]]-x[v[i]]+1;
writeln(s);
close(input);close(output);
end.