Cod sursa(job #109893)

Utilizator cristy_ganeaCriSTY cristy_ganea Data 25 noiembrie 2007 12:54:09
Problema Pairs Scor 0
Compilator fpc Status done
Runda preONI 2008, Runda 1, Clasele 11-12 Marime 0.44 kb
program pairs;
type multime=set of 0..100;
var M:multime;
    f,g:text;
    x,y,nr,k,i,N:longint;
begin
nr:=0;
assign(f,'pairs.in');
assign(g,'pairs.out');
reset(f);
readln(f,N);
if (N<2) or (N>100000) then exit;
M:=[];
for i:=1 to N do
begin
readln(f,k);
M:=M+[k];
end;
close(f);
for x:=1 to 100 do
for y:=1 to 100 do
begin
if (x in M) AND (y in M) AND (x<>y) then
nr:=nr+1;
end;
rewrite(g);
write(g,nr);
readln;
end.