百度首页 | 百度空间
 
查看文章
 
某莎滴某某未通过程序段放出……~~~
2008-09-27 23:24
     function main():longint;
    begin
      noden:=n;
      rest:=dat;
         pathn:=0;
        path[0]:=1;
        h[1]:=true;
      DFS();
        main:=ans;
      end;
     function DFS():integer;
    var
      i:integer;
    begin
      if path[pathn]=noden then
          exit(core());
        for i:=1 to noden do
          if not h[i] and (rest[path[pathn],i]>0) then
          begin
            h[i]:=true;
              inc(pathn);
              path[pathn]:=i;
              re:=DFS();
              dec(pathn);
              h[i]:=false;
              if (re<>0) and (re<>pathn) then
              exit(re);
            end;
        DFS:=0;
      end;
     function core():integer;
    var
      i:integer;
        min:longint;
    begin
      core:=0;
      for i:=2 to pathn do
          if rest[path[i-1],path[i]]<rest[path[core],path[core+1]] then
            core:=i-1;
         min:=rest[path[core],path[core+1]];
        for i:=1 to pathn do
        begin
          dec(rest[path[i-1],path[i]],min);
            inc(rest[path[i],path[i-1]],min);
          end;
        inc(ans,min);
      end;
知道偶写滴系虾米滴同学帮下忙~~~~帮偶看下哪里错了~~~~~T_T~~~~大部分数据系可以过滴说~~~~
偶还是去写***flow好了~~~~=。=

类别:Daily Informatics | 添加到搜藏 | 浏览() | 评论 (5)
 
最近读者:
 
网友评论:
1
2008-09-29 02:16
noio 2007 core?
 
2
2008-09-29 10:50
……不是滴说……
 
3
2008-09-29 13:08
娜娜貌似帮不上了~~

祝莎莎假期开心~~
 
4
2008-09-29 21:38
话说…………偶这段程序滴思想本身已经错了~~~~~=。=
 
5
2008-09-29 22:01
orz..........
 
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码:
 

     

©2008 Baidu