码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
C++学习笔记8,const在函数方面的使用(二)
const在函数中也有很大的作用。 4.const修饰传入参数。      函数传入参数声明为const,以指明使用这种参数仅仅是为了效率的原因,而不是想让调用函数能够修改该传入参数的值。同理,将对象指针参数或引用参数声明为const,函数将不修改由这个参数所指的对象。     例如: #include using namespace std; //void change(const i...
分类:编程语言   时间:2014-05-26 05:52:27    阅读次数:266
hdu-1166-敌兵布阵-线段树-单点更新,区域查询
线段树的单点更新,区域查询操作。 #include #include #include #include #include using namespace std; #define lmin 1 #define rmax n #define lson l,(l+r)/2,rt<<1 #define rson (l+r)/2+1,r,rt<<1|1 #define root lmin,rmax,1...
分类:其他好文   时间:2014-05-26 05:25:50    阅读次数:187
图书管理系统 library
#include #include #include #include #include #include using namespace std; void display(int);//输出信息 int size=0; class Book { public: void welcome();//欢迎界面 void welcome1(); void addboo...
分类:其他好文   时间:2014-05-26 04:57:10    阅读次数:344
层次遍历二叉树
按先序序列输入字符序列(其中逗号表示空节点),输出该二叉树的层次遍历序列。 #include #define END ','//表示空节点 using namespace std; typedef char Elem_Type; typedef struct BiTree { Elem_Type data; struct BiTree *Lchild; stru...
分类:其他好文   时间:2014-05-26 04:53:07    阅读次数:261
2014 BNU 邀请赛B题(枚举)
Beautiful Garden 题意:x轴上放了一些树,现在要移动一些树使得所有树都等间距,问最少要移动多少棵 思路:枚举,枚举第一棵树,和另一棵树,以及中间有多少树,这样就能知道等差数列的首项和公差,然后再循环一边计算出答案,保存最小值 代码: #include #include #include #include using namespace std; #define...
分类:其他好文   时间:2014-05-26 04:28:52    阅读次数:233
poj-3264-Balanced Lineup-线段树-区域查询
区域查询操作。 ma[i]:i区间内的最大值 mi[i]:i区间内的最小值 #include #include #include #include #include using namespace std; #define INF 99999999 #define lmin 1 #define rmax n #define lson l,(l+r)/2,rt<<1 #define rson ...
分类:其他好文   时间:2014-05-26 04:11:41    阅读次数:202
[HAOI2010]最长公共子序列
#include #include #include using namespace std; const int m=(int)1E8; string s1,s2; int f[2][5001]={0},g[2][5001]={0}; void init(); void work(); int my_max(int,int); int main() { freopen("lcs.in","r"...
分类:其他好文   时间:2014-05-26 04:07:17    阅读次数:305
hdu-1698-Just a Hook-线段树-区域更新,区域查询
flag[i]:标记i这个区间的值。 val[i]:i这个区间的长度 #include #include #include #include #include using namespace std; #define INF 99999999 #define lmin 1 #define rmax n #define lson l,(l+r)/2,rt<<1 #define rson (l+r...
分类:其他好文   时间:2014-05-26 03:37:19    阅读次数:203
zoj-1610-Count the Colors-线段树-区域更新,单点查询
线段树的区域更新,然后单点查询。 x1 x2 c:区域更新x1-x2为c。 全部染色之后,从0-8000依次查询每个点的颜色。然后存贮每一种颜色有几块。 #include #include #include #include #include using namespace std; #define lmin 0 #define rmax 8000 #define lson l,(l+r)/...
分类:其他好文   时间:2014-05-24 19:10:12    阅读次数:221
poj 2401 划分树 求区间第k大的数
题目:http://poj.org/problem?id=2104 划分树待我好好理解下再写个教程吧,觉得网上的内容一般,,, 模板题: 贴代码: #include #include #include #include using namespace std; #define CLR(a) memset(a,0,sizeof(a)) const int MAXN = 100010...
分类:其他好文   时间:2014-05-24 18:10:18    阅读次数:276
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!