### 可真的没有
### 插入不了代码
#### qwq
by ☆La™塩鱻© @ 2019-07-25 15:17:59
@[☆La™塩鱻©](/space/show?uid=64454)
你点</>
by Gary818 @ 2019-07-25 15:18:27
### qwq没有呢
by ☆La™塩鱻© @ 2019-07-25 15:18:57
@[☆La™塩鱻©](/space/show?uid=64454)
或者
```cpp
```cpp
在这里写代码
``再写一个点
```
by Gary818 @ 2019-07-25 15:19:20
@[海阔天空818](/space/show?uid=154412)
# thx
## 我改对了
by ☆La™塩鱻© @ 2019-07-25 15:19:26
@[☆La™塩鱻©](/space/show?uid=64454)
你是小姐姐吗
by Gary818 @ 2019-07-25 15:19:52
```
#include<cstdio>
#include<algorithm>
using namespace std;
struct la
{
int u,v,w;
}e[200005];
int n,m;
int father[200005];
int ans,cnt;
inline int find(int x)
{
if (father[x] == x) return x;
return father[x] = find(father[x]);
}
inline void kruskal()
{
for (int i = 1;i <= n;i++)
father[i] = i;
for (int i = 1;i <= m;i++)
{
int u = e[i].u;
int v = e[i].v;
int fa1 = find(u);
int fa2 = find(v);
if (fa1 != fa2)
{
ans += e[i].w;
father[fa1] = fa2;
if (cnt++ == n - 1)
break;
}
}
if (cnt < n - 1)
printf("orz\n");
else
printf("%d\n",ans);
}
bool cmp(la a,la b)
{
return a.w < b.w;
}
int main()
{
scanf("%d%d",&n,&m);
ans = cnt = 0;
for (int i = 1;i <= m;i++)
scanf("%d%d%d",&e[i].u,&e[i].v,&e[i].w);
sort(e + 1,e + m + 1,cmp);
kruskal();
return 0;
}
```
by ☆La™塩鱻© @ 2019-07-25 15:20:08
@[海阔天空818](/space/show?uid=154412) emm
by ☆La™塩鱻© @ 2019-07-25 15:20:20
@[☆La™塩鱻©](/space/show?uid=64454)
学会了吧,多简单
by Gary818 @ 2019-07-25 15:20:29
@[☆La™塩鱻©](/space/show?uid=64454)
到底是不是呢
by Gary818 @ 2019-07-25 15:20:54