- 博客(8)
- 收藏
- 关注
原创 Java中带自变量的构造函数
虽然在前面的例子中,Box构造函数确实初始化了Box对象,但它不是很有用,因为所有的盒子都是一样的尺寸。我们所需要的是一种能够构造各种各样尺寸盒子对象的方法。比较容易的解决办法是对构造函数增加自变量。你可能已经猜到,这将使他们更有用。例如,下面版本的Box程序定义了一个自变量构造函数,它根据自变量设置每个指定盒子的尺寸。特别注意Box对象是如何被创建的。class Box {double ...
2020-01-04 22:12:16 297
原创 树的遍历_A1106 Lowest Price in Supply Chain (25 分)
A1106 Lowest Price in Supply Chain (25 分)#include<iostream>using namespace std;#include<cstdio>#include<vector>#include<cmath>const int MAXN=100010;const double INF=1e...
2019-08-22 17:16:50 117
原创 树的遍历_A1094 The Largest Generation (25 分)
A1094 The Largest Generation (25 分)#include<iostream>using namespace std;#include<cstdio>#include<vector>const int MAXN=110;vector<int> node[MAXN];int hashTable[MAXN]=...
2019-08-22 16:38:55 137
原创 树的遍历_A1090 Highest Price in Supply Chain (25 分)
A1090 Highest Price in Supply Chain (25 分)#include<iostream>using namespace std;#include<cstdio>#include<vector>#include<cmath>const int MAXN=100010;vector<int>...
2019-08-22 16:03:41 133
原创 树的遍历_A1079 Total Sales of Supply Chain (25 分)
A1079 Total Sales of Supply Chain (25 分)#include<iostream>using namespace std;#include<cstdio>#include<vector>#include<cmath>const int MAXN=100010;struct Node { d...
2019-08-22 15:07:56 79
原创 二叉树的遍历_A1102 Invert a Binary Tree (25 分)
A1102 Invert a Binary Tree (25 分)#include<iostream>#include<cstdio>#include<queue>#include<algorithm>using namespace std;const int maxn=110;struct node{ //二叉树的静态写法 ...
2019-08-21 09:03:08 90
原创 二叉树的遍历_A1086 Tree Traversals Again (25 分)
A1086 Tree Traversals Again (25 分)#include<iostream>#include<cstdio>#include<cstring>#include<stack>#include<algorithm>using namespace std;const int maxn=50;str...
2019-08-21 08:51:19 208
原创 二叉树的遍历_A1020 Tree Traversals (25 分)
A1020 Tree Traversals (25 分)#include<iostream>#include<cstdio>#include<queue>using namespace std;//在此处声明变量int num,postOrder[33],inOrder[33];struct node { //结构体node int ...
2019-08-21 08:30:34 99
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人