结论为所有边权的和。
至于为什么,我不知道qwq
#include<cstdio>
#include<cstring>
#include<algorithm>
#define int long long
using namespace std;
const int maxn=2e3+1,maxnn=2e6+1;
int n;
int fa[maxn],ans=0,len1;
int C[maxn];
signed main(){
freopen("tree.in","r",stdin);
freopen("tree.out","w",stdout);
scanf("%lld",&n);
for(int i=1;i<n;i++){
int u,v,w;scanf("%lld%lld%lld",&u,&v,&w);
ans+=w;
}
printf("%lld
",ans);
return 0;
}