Cod sursa(job #45658)
Utilizator | Data | 1 aprilie 2007 19:35:47 | |
---|---|---|---|
Problema | Triplete | Scor | 20 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
const MAX=4096;
var f,g:text;
a:array[1..MAX,1..MAX] of byte;
{ v:array[0..MAX*MAX] of byte;}
t,n1,n2,n3,nt,x,y,n,m,i,j,k,num:word;
begin
assign(f,'triplete.in');
reset(f);
read(f,n,m);
num:=0;
for t:=1 to m do begin
read(f,i,j);
{if a[i,j]=1 then continue;}
a[i,j]:=1;
a[j,i]:=1;
for k:=1 to n do
if a[i,k] and a[k,j]=1 then
num:=num+1;
end;
close(f);
assign(g,'triplete.out');
rewrite(g);
writeln(g,num);
close(g);
end.