- 博客(3)
- 资源 (3)
- 收藏
- 关注

原创 计蒜客 最短路习题 圣诞树
许久未更新,今天做到一道有意思的题目,先上图,然后细说 这道题大体意思是给定一张无向图,其边权为正,要你求出总代价最小的生成树,生成树上 每条边 v(e)的代价为 w(e)*s(j),w(e)为边(i,j)的权值,s(j)是 对于 j 节点所在子树的节点 数总和。 题解: 该题看起来是最...
2018-09-06 18:11:56
530

原创 计蒜客 :农场看守
这一题是使用DFS实现欧拉回路。具体AC代码如下,第一次写博客,如有错误,欢迎指正。#include <iostream> #include <vector> using namespace std; #define maxn 50000+10 int n,m; struct Edge { int v; bool vis; Edge(int v,bo...
2018-05-04 21:41:53
343
原创 计蒜客习题: 最短路简化版
#include <bits/stdc++.h> using namespace std; const int maxn=1010; vector<int> p[maxn]; //建图 int d[maxn]; //距离 void init(){ memset(d,-1,sizeof(d)); //d=-1时代表尚未经过该边 } void bfs(int cur){...
2018-05-08 18:47:01
738
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人