码迷,mamicode.com
首页 >  
搜索关键字:const 底层const 顶层const    ( 26295个结果
const和readonly的区别
const是静态常量,const是编译时常量;readonly是动态常量,是运行时常量,const较高效,readonly较灵活。1.const默认是静态的,只能由类型来访问,不能与static同时使用;readonly默认是非静态的,由实例对象来访问,可以显示使用static定义为静态成员;2.c...
分类:其他好文   时间:2014-07-01 19:10:28    阅读次数:206
hdu 1596 find the safest road(乘积最短路)
题目:         链接:点击打开链接 题意: 思路:         对dijkstra稍作修改即可,每次更新dis[]时改为乘积。 代码: #include #include #include using namespace std; #define INF 100000000 const int N = 1010; int n,m; double map[N][N]...
分类:其他好文   时间:2014-07-01 10:53:50    阅读次数:180
POJ 1611 The Suspects 并查集 Union Find
本题也是个标准的并查集题解。 操作完并查集之后,就是要找和0节点在同一个集合的元素有多少。 注意这个操作,需要先找到0的父母节点,然后查找有多少个节点的额父母节点和0的父母节点相同。 这个时候需要对每个节点使用find parent操作,因为最后状态的时候,节点的parent不一定是本集合的根节点。 #include const int MAX_N = 30001; stru...
分类:其他好文   时间:2014-07-01 10:50:15    阅读次数:179
[转载]关于C++ const 的全面总结
C++中的const关键字的用法非常灵活,而使用const将大大改善程序的健壮性,本人根据各方面查到的资料进行总结如下,期望对朋友们有所帮助。Const是C++中常用的类型修饰符,常类型是指使用类型修饰符const说明的类型,常类型的变量或对象的值是不能被更新的。一、Const作用如下表所示:No....
分类:编程语言   时间:2014-07-01 10:39:08    阅读次数:265
hdu 3172 Virtual Friends (并查集 + 字典树)
题目:         链接:点击打开链接 题意:         输入n,给出n行数据,每行有两个字符串,输出关系网络中朋友的个数,n行。 思路:          代码: #include #include #include #include using namespace std; const int N = 22; const int M = 200020; st...
分类:其他好文   时间:2014-07-01 08:14:07    阅读次数:189
hdu 2818 Building Block(带权并查集)
题目:         链接: 题意: 思路: 代码: #include #include #include using namespace std; const int N = 30030; int root[N]; int sum[N],rank[N];//sum[i]表示i下面的积木个数 int q; int findset(int x) { if(x == r...
分类:其他好文   时间:2014-07-01 08:12:55    阅读次数:178
如何禁止C++ 类支持拷贝
如何禁止C++ 类支持拷贝 C++ 编译器默默地为你做了不少工作 当你写下 class Empty {}; //其实等价于 class Empty { public: Empty() { ... } //default constructor Empty(const Empty &rhs) { ... } //copy constructor ~Empty() { ......
分类:编程语言   时间:2014-07-01 08:04:25    阅读次数:274
POJ 2524 Ubiquitous Religions Union Find 并查集
本题是标准的并查集了,最后利用这些集求有多少独立集。 所以这里也写个标准程序过了。 最后查找独立集合: 看有多少个节点的父母节点是自己的,那么就是独立集合了。自己做自己的父母当然最独立的了,没有任何依赖,呵呵。 #include const int MAX_N = 50001; //const int MAX_M = MAX_N/2 * (MAX_N-1) + 1; int N, M; ...
分类:其他好文   时间:2014-07-01 07:46:53    阅读次数:160
hdu 1690 Bus System(最短路)
问题:         链接:点击打开链接 题意: 思路: 代码: #include #include #include using namespace std; #define INF 1000000000000 typedef __int64 LL; const int N = 110; __int64 dis[N][N],place[N]; __int64 L1,L2,L...
分类:其他好文   时间:2014-07-01 07:16:25    阅读次数:248
hdu 1535 Invitation Cards(有向图的来回最短路,要反向建图)
题目:         链接:点击打开链接 题意:         给一个图,求1到各点和各点到1最短路。 思路:         先spfa,然后反向建图,在spfa就行了。 代码: #include #include #include #include using namespace std; #define INF 100000000 const int N = 10...
分类:其他好文   时间:2014-07-01 07:15:44    阅读次数:230
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!