foo.cc:40:20: warning: extra tokens at end of #include directive
40 | #include<iostream> #include<cstdio> #include<algorithm> using namespace std; int n,m,k,sum,ans,fa[10005]; struct node{ int x,y,w; }edge[100005]; bool cmp(node a,node b) { return a.w<b.w; }int find(int x) { if(x==fa[x]) return x; else return fa[x]=find(fa[x]); }int main() { cin>>n>>m>>k; for(int i=1;i<=m;i++) scanf("%d%d%d",&edge[i].x,&edge[i].y,&edge[i].w); sort(edge+1,edge+m+1,cmp); for(int i=1;i<=n;i++) fa[i]=i; for(int i=1;i<=m;i++){ int xx=edge[i].x; int yy=edge[i].y; int fx=find(xx); int fy=find(yy); if(fx==fy) continue; fa[fx]=fy; sum++; ans+=edge[i].w; if(sum==n-k) break; }if(sum==n-k) printf("%d",ans); else printf("No Answer"); return 0; }
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status
[Hydro](https://hydro.ac)提供评测服务