码迷,mamicode.com
首页 >  
搜索关键字:namespace    ( 41927个结果
第六周 【项目6-复数模板类】
运行代码: /* *Copyright (c)2014,烟台大学计算机与控制工程学院 *All rights reserved. *dood luck *文件名称:d.cpp *作 者:张旺华 *完成日期:2015年4月15日 *版 本 号:v1.0 * */ //项目6-复数模板类】 //该例实现了一个复数类,但是美中不足的是,复数类的实部和虚部都固定只能是doub...
分类:其他好文   时间:2015-04-15 17:03:43    阅读次数:94
log4cxx,vs2013/vs2010编译 c2252错误
换编译器编译和使用log4cxx时遇到c2252错误error C2252: an explicit instantiation of a template can only occur at namespace scope搜索了一下解决方案,在log4cxx邮件列表有如下关于该bug解决方案的描述...
分类:其他好文   时间:2015-04-15 16:47:00    阅读次数:340
C++类对象的拷贝构造函数分析
对于普通类型的对象来说,它们之间的复制是很简单的,例如:int a=100;int b=a;而类对象与普通对象不同,类对象内部结构一般较为复杂,存在各种成员变量。下面看一个类对象拷贝的简单例子。#include using namespace std;class CA{ public: CA(in....
分类:编程语言   时间:2015-04-15 16:35:57    阅读次数:161
装饰模式
#include using namespace std;/* Component 类 */class Component {public: virtual void Operation() = 0;};/* 具体Component类,被修饰 */class ConcreteComponent...
分类:其他好文   时间:2015-04-15 16:33:32    阅读次数:106
【树上莫队】【带修莫队】bzoj3052 [wc2013]糖果公园
#include#include#include#includeusing namespace std;#define N 100001typedef long long ll;int v[NQ[i].t;--j) { if(vis[CH[j].x]) ...
分类:其他好文   时间:2015-04-15 16:23:48    阅读次数:614
LightOJ 1314 Names for Babies
刚开始求height数组的地方写错了,看来还是理解不够透彻啊 所有的子串减去重复的子串 //先在草稿纸上把思想想清楚再动手,不要只是有个大概的思想,不然容易出错 #include #include #include using namespace std; #define N 10005 int n; char s[N]; int r[N],sa[N],height[N],rank[N],...
分类:其他好文   时间:2015-04-15 14:56:59    阅读次数:202
[c++]派生类与容器类
#include using namespace std; class Base { int x; public: Base(int a) { x = a;//记得给私有成员赋初值,没有的话会是随机值 cout<<"constructing Base "<<x<<endl; } ~Base() { co...
分类:编程语言   时间:2015-04-15 14:56:27    阅读次数:154
BZOJ 1941 Sdoi2010 Hide and Seek K-Dimensional-Tree
题目大意:给定平面上的n个点,定义距离为曼哈顿距离,求一个点到其他所有点的最大距离与最小距离之差最小 KDTree……这东西好神啊 注意计算最小距离的时候不能把自己也算进去= = #include #include #include #include #define M 500500 #define INF 0x3f3f3f3f using namespace std; struct...
分类:其他好文   时间:2015-04-15 13:42:12    阅读次数:327
C++快速排序(随机值元法)
#include #include using namespace std; int sum(int a,int b) { return (rand()%(b-a)+a+1); } void Grial(int a[],int x,int y) { if(x>=y)return ; int i=x; int j=y; int temp; int b=sum(i,j);//求取随机值...
分类:编程语言   时间:2015-04-15 13:39:30    阅读次数:154
POJ 1743 Musical Theme
都在注释里了 //第一个想法是枚举那个差值,然后把该字符串复制一遍加在后面 //看了网上的做法,仔细观察一下同一主题的两个字符串,发现都加上一个数之后,虽然值变了,但相邻的数的差值是没有变的 //所以可以对相邻数的差值求height数组 #include #include using namespace std; #define N 20005 int n; int s[N],r[N],sa...
分类:其他好文   时间:2015-04-15 13:37:26    阅读次数:112
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!