• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






种梦想的路

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

随笔分类 -  最小生成树

 
poj 2395
摘要:用的是克鲁斯卡尔算法,跟2485差不多,也是求最小生成树中最长的一段program poj2395;type node=record x,y,c:longint; end;var a:array[1..10000] of node; father:array[1..2000] of integer; n,m,i,k,ans:longint;procedure quick(left,right:integer);var i,j,temp:longint; p:node;begin i:=left; j:=right; temp:=a[(i+j) div 2].c; while i<=j d 阅读全文
posted @ 2013-01-23 09:15 种梦想的路 阅读(116) 评论(0) 推荐(0)
poj 2485
摘要:求最小生成树中最长的一段program poj2485;var a:array[1..500,1..500] of longint; d,closed:array[1..500] of longint; flag:array[1..500] of boolean; p,q,ans,n:longint;procedure init;var i,j:integer;begin fillchar(a,sizeof(a),0); readln; readln(n); for i:=1 to n do begin for j:=1 to n do read(a[i,j]); readln; end;en 阅读全文
posted @ 2013-01-23 09:12 种梦想的路 阅读(100) 评论(0) 推荐(0)
poj1258
摘要:很水的最小生成树题prim算法:program poj1258;var a:array[1..100,1..100] of longint; b:array[1..100] of longint; c:array[1..100] of integer; n,i,j:integer; ans:longint;procedure prim;var k:integer; min:longint;begin for i:=2 to n do begin b[i]:=a[1,i]; c[i]:=1; end; for i:=2 to n do begin min:=maxlongint; for j:= 阅读全文
posted @ 2012-07-16 22:02 种梦想的路 阅读(107) 评论(0) 推荐(0)