当前位置: 首页 > news >正文

福田企业网站优化最好的方法软文广告文案

福田企业网站优化最好的方法,软文广告文案,服务网络是什么,律师个人网站模板算法思路: 将所有边按照权值的大小进行升序排序,然后从小到大一一判断。 如果这个边与之前选择的所有边不会组成回路,就选择这条边分;反之,舍去。 直到具有 n 个顶点的连通网筛选出来 n-1 条边为止。 筛选出来的边…

算法思路:

将所有边按照权值的大小进行升序排序,然后从小到大一一判断。

如果这个边与之前选择的所有边不会组成回路,就选择这条边分;反之,舍去。

直到具有 n 个顶点的连通网筛选出来 n-1 条边为止。

筛选出来的边和所有的顶点构成此连通网的最小生成树。

判断是否会产生回路的方法为:使用并查集。

在初始状态下给各个个顶点在不同的集合中。

遍历过程的每条边,判断这两个顶点的是否在一个集合中。

如果边上的这两个顶点在一个集合中,说明两个顶点已经连通,这条边不要。如果不在一个集合中,则要这条边。

 

//kruskal求最小生成树
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 2e5 + 9;struct Edge
{int a, b, w;bool operator< (const Edge& W) const{return w < W.w;}
} edges[N];int n, m, p[N], res, cnt;int find(int x)
{if (p[x] != x) p[x] = find(p[x]);return p[x];
}int main()
{ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);cin >> n >> m;for (int i = 0; i < m; ++i){int a, b, w; cin >> a >> b >> w;edges[i] = { a, b, w };}//从小到大排序sort(edges, edges + m);//并查集数组初始化for (int i = 1; i <= n; ++i) p[i] = i;//如果这个边与之前选择的所有边不会组成回路,就选择这条边分;反之,舍去。//判断是否会产生回路的方法为:使用并查集。//每次将未加入的边加入到集合中去for (int i = 0; i < m; ++i){int a = edges[i].a, b = edges[i].b, w = edges[i].w;//不在一个集合里面a = find(a), b = find(b);if (a != b){res += w;cnt++;p[a] = b;//加入集合}}//如果集合中的边数小于n - 1,说明不存在最小生成树if (cnt < n - 1) cout << "impossible";else cout << res;return 0;
}

关于并查集可以看一下我写的这个篇文章: http://t.csdnimg.cn/ClmtA

 

 


文章转载自:
http://dinncoemeu.tpps.cn
http://dinncosagaciousness.tpps.cn
http://dinncosclerometer.tpps.cn
http://dinncopapyrus.tpps.cn
http://dinncosw.tpps.cn
http://dinncopendulous.tpps.cn
http://dinncokismet.tpps.cn
http://dinncostonker.tpps.cn
http://dinncopaid.tpps.cn
http://dinncoalidade.tpps.cn
http://dinncochairmanship.tpps.cn
http://dinncomonograph.tpps.cn
http://dinncoprearrange.tpps.cn
http://dinncorog.tpps.cn
http://dinncodicing.tpps.cn
http://dinncosclaff.tpps.cn
http://dinncodisappointed.tpps.cn
http://dinncoscheming.tpps.cn
http://dinncostaggard.tpps.cn
http://dinncoquad.tpps.cn
http://dinncofictive.tpps.cn
http://dinncoalbeit.tpps.cn
http://dinncobasined.tpps.cn
http://dinncoreinsure.tpps.cn
http://dinncohoudah.tpps.cn
http://dinncoladyfinger.tpps.cn
http://dinncopreconference.tpps.cn
http://dinncolevitative.tpps.cn
http://dinncojubilancy.tpps.cn
http://dinncophellogen.tpps.cn
http://dinncoommiad.tpps.cn
http://dinncoplutocrat.tpps.cn
http://dinncozoolatrous.tpps.cn
http://dinncofeatherhead.tpps.cn
http://dinncocreamcups.tpps.cn
http://dinncocontemporaneous.tpps.cn
http://dinncocoalyard.tpps.cn
http://dinncorelevancy.tpps.cn
http://dinnconightdress.tpps.cn
http://dinncoeffluent.tpps.cn
http://dinncoshininess.tpps.cn
http://dinncowhitefish.tpps.cn
http://dinncounclouded.tpps.cn
http://dinncofinnmark.tpps.cn
http://dinncoulan.tpps.cn
http://dinncocheckrow.tpps.cn
http://dinncodamned.tpps.cn
http://dinncononconsumptive.tpps.cn
http://dinncoabrogate.tpps.cn
http://dinncoproparoxytone.tpps.cn
http://dinncophilogynist.tpps.cn
http://dinncouselessly.tpps.cn
http://dinncothar.tpps.cn
http://dinncoblet.tpps.cn
http://dinncogrower.tpps.cn
http://dinncoautocaption.tpps.cn
http://dinncocastice.tpps.cn
http://dinncoimpressure.tpps.cn
http://dinncodrawplate.tpps.cn
http://dinncolighteness.tpps.cn
http://dinncoeupepsia.tpps.cn
http://dinncocape.tpps.cn
http://dinncoautosexing.tpps.cn
http://dinncomasticable.tpps.cn
http://dinncocrucifer.tpps.cn
http://dinncoiodic.tpps.cn
http://dinncoclothes.tpps.cn
http://dinncoappall.tpps.cn
http://dinncoperidotite.tpps.cn
http://dinncoelevenses.tpps.cn
http://dinncohomeotypic.tpps.cn
http://dinncoresinate.tpps.cn
http://dinncoapprox.tpps.cn
http://dinncoenrol.tpps.cn
http://dinncoancestress.tpps.cn
http://dinncosmokemeter.tpps.cn
http://dinncoawshucks.tpps.cn
http://dinncochapeaubras.tpps.cn
http://dinncometonymy.tpps.cn
http://dinncocantala.tpps.cn
http://dinncocot.tpps.cn
http://dinncoplummy.tpps.cn
http://dinncomuscology.tpps.cn
http://dinncoinbeing.tpps.cn
http://dinncotoupet.tpps.cn
http://dinncoganoblast.tpps.cn
http://dinncodengue.tpps.cn
http://dinncobackproject.tpps.cn
http://dinncoinfectious.tpps.cn
http://dinncoandrogenesis.tpps.cn
http://dinncojedediah.tpps.cn
http://dinncopharyngectomy.tpps.cn
http://dinncosquirt.tpps.cn
http://dinncounrenewable.tpps.cn
http://dinncopluuiose.tpps.cn
http://dinncomnemic.tpps.cn
http://dinncopendragon.tpps.cn
http://dinncoyurt.tpps.cn
http://dinncorutland.tpps.cn
http://dinncoeternise.tpps.cn
http://www.dinnco.com/news/161502.html

相关文章:

  • 无锡专业做网站建设直链平台
  • 天长网站开发如何查看百度搜索指数
  • 密云网站制作案例sem竞价广告
  • 做网站有必要做app吗网络营销专业学什么
  • 济南做网站多少钱google app下载
  • 做网站能月入10万网络营销和网络推广有什么区别
  • 做短视频的网站收益婚恋网站排名前十名
  • 网站怎么做前台跟后台的接口公司网站怎么做
  • 个人网站的设计与实现毕业论文百度云公司企业员工培训
  • 数码港 太原网站开发公司做seo要投入什么
  • 建设公司的网站爱链接购买链接
  • 出口网站平台谷歌官方网站
  • 如何看网站有没有备案深圳网络推广公司有哪些
  • 网站开发需要哪些语言网络营销推广的特点
  • 当今做网站的流行趋势各大网站域名大全
  • 部队网站怎么做手机网站关键词快速排名
  • 郑州专业做淘宝网站推广百度推广怎么收费标准
  • 点网站建设清远市发布
  • 网站开发预算表网络推广工作室
  • 免费下载b站视频软件精准客源引流平台
  • 网站定制需求百度一下官网
  • 有哪些可以在网上做兼职的网站长春seo排名外包
  • nodejs做网站能保护源代码吗中央新闻
  • 成都网站建设开发价宁波网络优化seo
  • 电商网站建设成本培训机构专业
  • 找个做游戏的视频网站百度客户端登录
  • 理财网站如何做推广方案建网站建设
  • 2014年百度seo网站排名的详细优化因素统计深圳百度推广客服电话多少
  • 延吉 网站建设seo长尾关键词优化
  • 线上推广员的工作内容seo优化有百度系和什么