自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(6)
  • 收藏
  • 关注

原创 1106 Lowest Price in Supply Chain (25 分)

相同的套路,与A1079、A1090、A1094、A1004、A1053类似,都是用dfs或bfs遍历静态二叉树 #include<iostream> #include<vector> #include<math.h> using namespace std; #define maxn 100000 int n; double price,rate; struc...

2019-10-04 23:58:17 127

原创 1094 The Largest Generation (25 分)

bfs或dfs // // Created by dgm on 2019/10/3. // #include <iostream> #include <vector> using namespace std; #define maxn 110 struct node{ vector<int>children; int level; }t[maxn...

2019-10-03 23:13:32 133

原创 1090 Highest Price in Supply Chain (25 分)

实际是求叶节点的最大深度和统计位于最大深度处的叶节点个数 可结合A1079题 // // Created by dgm on 2019/10/2. // #include <iostream> #include <vector> #include <math.h> #define maxn 100000 using namespace std; struct n...

2019-10-02 23:28:06 123

原创 1079 Total Sales of Supply Chain (25 分)

层序遍历,遍历到父节点时给出子节点所在层次即父节点层号加一,遍历到叶节点时把物品数量与价格(本零售商的价格)的乘积加到sum中 也可用深度遍历,递归时深度作参数 // // Created by dgm on 2019/10/1. // #include <iostream> #include <vector> #include <math.h> using n...

2019-10-02 23:25:20 322

原创 1102 Invert a Binary Tree (25 分)

用静态二叉树,中序遍历和层序遍历都先右再左 // // Created by dgm on 2019/10/1. // #include <iostream> using namespace std; #define maxn 20 struct node{ int left; int right; }t[maxn]; int n; void inTraverse(in...

2019-10-02 23:19:58 113

原创 1086 Tree Traversals Again (25 分)

祖国母亲生日快乐 前中后序遍历的路径是相同的,只是结点输出的顺序不同,这个深度遍历依次走过的节点与先序遍历相同,因此push顺序就是先序遍历顺序,再根据push和pop得到中序序列,就可以创建树。 // // Created by dgm on 2019/9/30. // #include <iostream> #include <stack> using namespac...

2019-10-01 00:21:16 171

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除