![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
dfs
伍振仁のblog
这个作者很懒,什么都没留下…
展开
-
1103 Integer Factorization
这道题可以说是终于踏出了算法的第一步,bfs 数据结构学过,发现学了跟没学差不多,从来没应用过,都是很教条的 时间16点35分,开始把 时间17点41分 代码 #include <cstdio> #include <vector> #include <algorithm> using namespace std; int n, k, p, maxFacsum ...原创 2019-02-02 17:42:51 · 576 阅读 · 0 评论 -
1090 Highest Price in Supply Chain
**发现一个很有意思的现象,用pow得出的数,%.2f会自动四舍五入,而普通变量则不行 本题代码 向大家问个问题,这道题怎么看出树结点的最大值呢?英文题看着头疼… #include <cstdio> #include <iostream> #include <string> #include <map> #include <set> #...原创 2019-02-04 01:40:22 · 102 阅读 · 0 评论 -
1079 Total Sales of Supply Chain详解在代码中
详解见代码 #include <cstdio> #include <iostream> #include <string> #include <map> #include <set> #include <cstring> #include <vector> #include <sstream&原创 2019-02-04 13:17:18 · 193 阅读 · 0 评论 -
1004 Counting Leaves
BFS #include <cstdio> #include <iostream> #include <string> #include <map> #include <set> #include <cstring> #include <vector> #include <sstream&g原创 2019-02-08 10:55:27 · 199 阅读 · 0 评论 -
1053 Path of Equal Weight
按照孩子的权值来进行排序,学到了 #include <cstdio> #include <vector> #include <queue> #include <algorithm> using namespace std; const int maxn = 110; struct BTnode { int weight; vector<in...原创 2019-02-11 18:05:04 · 119 阅读 · 0 评论 -
1034 Head of a Gang
这道题是DFS题,邻接矩阵存储,并且在每个联通图中找出total>K的联通图, 并记录此联通图中顶点权值最大的顶点,即head of hang 这里用map存储每个用户的名称及映射顶点序号. 输出的时候,也是用map<string, int> Gang 最后输出Gang.size(),以及依次输出 Gang->first\Gang.second 有个cas...原创 2019-02-18 13:32:00 · 409 阅读 · 0 评论