c++继承方式
公有继承,父类的私有成员不可访问,通过父类的公有函数以及保护函数访问
私有继承,父类成员在派生类中为私有成员等。
初始化顺序先父类,再是派生类,析构刚好相反,
当用父类指针或者引用实现多态时,析构函数要声明成虚函数,不然只会调用父类的析构函数
#include
using namespace std;
class base{
private :float x;
publ...
分类:
编程语言 时间:
2014-05-12 14:16:40
阅读次数:
361
#include
#include
#include
using namespace std;
#ifdef ONLINE_JUDGE
#define FINPUT(file) 0
#define FOUTPUT(file) 0
#else ...
分类:
其他好文 时间:
2014-05-12 14:12:35
阅读次数:
379
1.Object-C也是面向对象的语言;2.#include
//#include是一个预处理指令3.using namespace std;
//std是命名空间,using决定了该源程序中的代码可以不用指定命名空间名为std4.const
常量只能读,不能修改,并且定义时必须初始化;5.由低精度...
分类:
编程语言 时间:
2014-05-12 09:07:01
阅读次数:
365
树上背包,说实话写起来很难受。看到别人写的代码时间都那么短,实在是自愧不如。#include
#include using namespace std;#define MAXV (3000)#define MAXE (MAXV - 1)int
Vefw[MAXE], Ve...
分类:
其他好文 时间:
2014-05-12 09:02:54
阅读次数:
178
首先是CDQ《基于连通性状态压缩的动态规划问题》论文上的题目:URAL 1519
Formula 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxn
= 15; 6 const int H...
分类:
其他好文 时间:
2014-05-12 08:14:39
阅读次数:
433
#include
#include
#include
using namespace std;
#ifdef ONLINE_JUDGE
#define FINPUT(file) 0
#define FOUTPUT(file) 0
#else ...
分类:
其他好文 时间:
2014-05-12 06:30:08
阅读次数:
232
/*N^N = 10^(N*log(N))中,由于 N #includeusing namespace
std;double solve(double n){ double intpart,fractpart,t; //double modf (double,
double*); 将...
分类:
其他好文 时间:
2014-05-11 14:02:20
阅读次数:
350
//方法一
//对每个形如 (A*a+ B)* a^k的数,前面的A 没有意义的,只有B
//才有可能继续被用来作为未来的因子,所以每次只需要保留比a小的B 就够了。代码如下:
#include
#include
#include
using namespace std;
#ifdef ONLINE_JUDGE
#d...
分类:
其他好文 时间:
2014-05-11 13:29:39
阅读次数:
280
八数码0.0,我又来水博客了。
IDA*算法,A*为曼哈顿距离,判重用康拓展开。
#include
#include
#include
#include
#include
using namespace std;
int a[4][4];
int dx[]={0,0,-1,1};
int dy[]={-1,1,0,0};
char s[]="123804765";
int end[4]...
分类:
其他好文 时间:
2014-05-11 06:20:57
阅读次数:
334
题意:求在两边人数不相差超过1个的情况下,实力尽量相等的情况
思路:从实力和的一半开始类背包操作
#include
#include
#include
#include
using namespace std;
const int MAXN = 45010;
const int MAXM = 110;
int a[MAXM];
int dp[MAXN][MAXM];
int n;
...
分类:
其他好文 时间:
2014-05-11 05:02:03
阅读次数:
279