STL实现优先队列
使用方法:
头文件:
#include
声明方式:
priority_queueq;
结构体的声明方式:
struct node
{
int x, y;
friend bool operator b.x; //结构体中,x小的优先级高
}
};...
分类:
其他好文 时间:
2014-08-01 13:52:41
阅读次数:
186
#include
#include
typedef struct QNode
{ //构造结点类型
int data;
struct QNode *next;
}*QueuePtr;
typedef struct
{ QueuePtr front;
QueuePtr rear;
}LinkQueue;
void CreateQueue(LinkQueue &Q);//创建队列
void E...
分类:
其他好文 时间:
2014-08-01 13:51:24
阅读次数:
212
#include
#include
#include
typedef struct
{ char *ch;
int length;
}HString;
void StrAssign(HString &T,char chars[]);
int get_next(HString T,int next[]);
void main()
{ HString T;
char chars[80];
in...
分类:
其他好文 时间:
2014-08-01 13:51:23
阅读次数:
229
#include
#include
#define LENGTH 100 //初始分配栈的长度
#define ADD_LEN 10 //栈长增量
typedef struct //定义字符栈
{ int *base;
int *top;
int stacksize;
}SqStack;
void InitStack(SqStack &S); //初始化一...
分类:
其他好文 时间:
2014-08-01 13:50:31
阅读次数:
237
#include
#include
typedef struct
{ char *ch;
int length;
}HString;
void StrAssign(HString &T,char *chars);
void StrLength(HString S);
void StrCompare(HString S,HString T);
void ClearString(HString &S...
分类:
其他好文 时间:
2014-08-01 13:50:01
阅读次数:
123
#include
#include
#define LENGTH 100 //初始分配栈的长度
#define ADD_LEN 10 //栈长增量
typedef struct
{//构造栈的数据类型
int *base;
int *top;
int stacksize;
}SqStack;
void CreateStack(SqStack &S);//初始化一个栈
void PushS...
分类:
其他好文 时间:
2014-08-01 13:49:41
阅读次数:
187
就多个等于号纠结死
先按di排序,(从小到大)。然后依次完成合同,若发现第i个合同无法在截止日期前完成,便从之前已经完成的任务中选一个aj最大的合同,付钱来使得这个合同尽快完成。
#include
#include
#include
#include
#include
using namespace std;
struct node
{
int q;
in...
分类:
其他好文 时间:
2014-08-01 13:48:41
阅读次数:
239
该代码实现了tree的结构,依赖dyArray数据结构。有first一级目录,second二级目录。
dyArray的c实现参考这里点击打开链接 hashTable的c实现参考这里点击打开链接
下面是跨平台的数据类型定义
//
// cpPlatform.h
// dataStruct
//
// Created by hherima on 14-7-29.
// Copyrigh...
分类:
编程语言 时间:
2014-08-01 13:46:21
阅读次数:
279
Apple Treehttp://poj.org/problem?id=3321 1 #include 2 #include 3 #define mt(a,b) memset(a,b,sizeof(a)) 4 const int M=100010; 5 struct G{ 6 struct ...
分类:
其他好文 时间:
2014-08-01 13:18:11
阅读次数:
178
题意:给出袋子的体积和骨头的个数,然后又给出每个骨头的价值和体积,求袋子最多能装的骨头的价值
难点;这道题是最基础的01背包题,不懂得话推荐看《背包九讲》
AC by SWS
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=2602
代码:
#include
#include
typedef struct{
int w, v;
}str;...
分类:
其他好文 时间:
2014-08-01 10:55:11
阅读次数:
215