本段程序实现串的存储结构是采用堆的动态分配存储表示,并实现了几乎所有常用的串的配套函数
其中逻辑性比较强的就是串的模式匹配算法,在下面的程序中,分别用BF算法和KMP算法对其进行了
实现。
#include
using namespace std;
struct HString
{
HString()
{
ch = 0;
length = 0;
}
char * ch;//...
分类:
编程语言 时间:
2014-05-14 01:12:35
阅读次数:
378
#include
#include
#include
using namespace std;
#ifdef ONLINE_JUDGE
#define FINPUT(file) 0
#define FOUTPUT(file) 0
#else ...
分类:
其他好文 时间:
2014-05-14 00:18:31
阅读次数:
367
#include
#include
using namespace std;
#ifdef ONLINE_JUDGE
#define FINPUT(file) 0
#define FOUTPUT(file) 0
#else ...
分类:
其他好文 时间:
2014-05-13 23:42:33
阅读次数:
316
// boost_time.cpp : 定义控制台应用程序的入口点。
//made by davidsu33
//2014-5-11
//the usage of posix_time
#include "stdafx.h"
#include
#include
#include
using namespace std;
#define SHOW_VARIABLE(x){ cou...
分类:
其他好文 时间:
2014-05-13 09:12:49
阅读次数:
656
/*
ID:kevin_s1
PROG:dualpal
LANG:C++
*/
#include
#include
#include
#include
#include
using namespace std;
int N,S;
vector result;
bool isPalindromic(string num){
bool flag = true;
int len =...
分类:
其他好文 时间:
2014-05-13 06:10:09
阅读次数:
312
题目链接:点击打开链接
暴力出奇迹。
正解应该是最近点对,以i点为x轴,sum[i](前缀和)为y轴,求任意两点间的距离。
先来个科学的暴力代码:
#include
#include
#include
#include
#include
#include
using namespace std;
#define N 100050
#define ll __int64
ll a[N], su...
分类:
其他好文 时间:
2014-05-13 05:45:30
阅读次数:
283
本段程序主要利用数据结构栈的先进后出特点,实现回溯求解迷宫路径问题。
#include
#include
using namespace std;
//坐标类
struct Point
{
int x;
int y;
};
//地图类
template
struct Map
{
int (*p)[A];
int row;//行数
int col;//列数
};
//start起始点, ...
分类:
其他好文 时间:
2014-05-13 05:25:02
阅读次数:
478
题目来源:POJ 1006 Biorhythms
题意:给出3个周期第一次发生的时间 和 当前开始的天数 求三个周期下一次到达高峰期发生在哪一天
思路:这题很水 试一下我的模版而已
#include
#include
using namespace std;
typedef long long LL;
const int maxn = 10;
int a[maxn], m[maxn];
...
分类:
其他好文 时间:
2014-05-13 05:07:28
阅读次数:
253
理解二级指针,关键是理解指针的存储方式和意义。
这里以指向int型指针的指针为例,梳理一下二级指针在内存分配中 的奥妙....
#include
using namespace std;
int main()
{
int a[5] = {1, 2, 3, 4, 5};
int *p = a;
int **point = &p;
cout << "a = "...
分类:
其他好文 时间:
2014-05-12 23:22:28
阅读次数:
291
#include
//using namespace std;
class Matrix
{
public:
Matrix();
friend Matrix operator+(Matrix &,Matrix &);
friend ostream& operator
friend istream& operator>>(istream&,Matri...
分类:
其他好文 时间:
2014-05-12 22:39:15
阅读次数:
387