讨论 / 看看有什么问题
wjzzm 2009-05-02 18:59:00
点我顶贴 收藏 删除
program s1;

var a:array[1..200,1..200]of boolean;

b:array[1..200]of boolean;

q:array[1..200]of integer;

sum,n,m,heng,zong,i,j,k,l,o,p,max:integer;

procedure try(x,y:integer);

var j:integer;

begin

q[x]:=y;inc(sum);

for j:=1 to n do

if a[y,j] and b[j] then

begin

b[j]:=false;

try(x+1,j);

end;

end;

begin

readln(n,m);

for i:=1 to m do

begin

readln(heng,zong);

a[heng,zong]:=true;

a[zong,heng]:=true;

end;

fillchar(b,sizeof(b),true);

for i:=1 to n do

if b[i] then

begin

b[i]:=false;

fillchar(q,sizeof(q),0);

sum:=0;

try(1,i);

p:=0;

for l:=1 to sum do

begin

k:=0;

for o:=1 to n do

if a[q[l],o] then inc(k);

if k mod 2<>0 then p:=p+1;

end;

if p<>0 then

if p<2 then max:=max+1

else max:=max+p div 2;

end;

write(max);

end.

查看更多回复
提交回复