![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
文章平均质量分 62
xlhzxx8127
人菜瘾大
展开
-
kurskal算法的模板应用
洛谷P3366题目描述如题,给出一个无向图,求出最小生成树,如果该图不连通,则输出 orz。输入格式第一行包含两个整数 N,MN,MN,M,表示该图共有 NNN 个结点和 MMM 条无向边。接下来 MMM 行每行包含三个整数 Xi,Yi,ZiX_i,Y_i,Z_iXi,Yi,Zi,表示有一条长度为 ZiZ_iZi 的无向边连接结点 Xi,YiX_i,Y_iXi,Yi。输出格式如果该图连通,则输出一个整数表示最小生成树的各边的长度之和。如果该图不连通则输出 orz。输入输出样例输原创 2021-09-06 22:39:04 · 148 阅读 · 1 评论 -
贪心思想(2021/7/15)
DescriptionHere is a famous story in Chinese history.That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others.Both of Tian and the king have three horses in different cl原创 2021-07-15 00:58:29 · 91 阅读 · 0 评论