#include
#include
#include
using namespace std;
struct node{
int x , y ;
} p[2600];
int q[1200] ;
bool cmp(node a,node b)
{
return a.y < b.y || ( a.y == b.y && a.x < b.x ) ;
}
int main()
{...
分类:
其他好文 时间:
2014-07-30 17:44:44
阅读次数:
219
#include
#include
using namespace std;
typedef struct node
{
int val;
node *next;
}node;
node * create_list();
void traverse_list(node *pHead);
int get_len_list(node *pHead);
bool delete_list(no...
分类:
其他好文 时间:
2014-07-30 17:43:54
阅读次数:
237
顺序表指的是数据元素在内存中连续分配地址的数组,由于指针无法指出数组长度,编译时不会报错,所有用结构体来表示一个顺序表:
顺序表用C语言的表示方法如下:
#define MaxSize 100 #define OK 1
#define ERROR -1
typedef int elem_type;
typedef int Statue;
// int Arrylength...
分类:
其他好文 时间:
2014-07-30 17:36:44
阅读次数:
256
使用数据结构stack或者递归
1 使用stack
#include
#include
using namespace std;
typedef struct listNode{
int key;
struct listNode *pNext;
} * pNode,Node;
void createNode(pNode &pHead){
bool isFirst=true;...
分类:
其他好文 时间:
2014-07-30 17:30:34
阅读次数:
189
我们知道,增广路EK算法的时间负责度是O(n*m^2),找最短增广路的时间复杂度是O(m*n),所以时间复杂度主要是在找增广路上。
这里介绍另一种Dinci算法,用BFS构造层次图,然后用DFS增广。
模板
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#d...
分类:
其他好文 时间:
2014-07-30 14:49:03
阅读次数:
364
记忆化搜索。。
对每个点能走的最远进行记录,如果走过,直接返回上一层。。
最后遍历找出最大值。。
#include
#include
#include
#include
using namespace std;
struct node{
int q,w;
}s[104][105];
int a,b;
int yy[105][105];
int map[4][2]={1,0,-1,0,0,...
分类:
其他好文 时间:
2014-07-30 12:23:03
阅读次数:
179
枚举所有相邻城市,作为起点,多次spfa,然后每次在想去的城市中找出spfa后的距离起点最短的花费时间
#include
#include
#include
using namespace std;
#define MAX 1005
#define INF 1<<30
int T,S,D;
struct Edge{
int to,time,next;
}edge[MAX*2...
分类:
其他好文 时间:
2014-07-30 12:19:03
阅读次数:
215
引言首先看一个C语言下结构体的小程序。#includestruct StudentInfo { char i; int j;};void main() { printf("%d\n",sizeof(struct StudentInfo)); }输出结果:8不解,以为是...
public enum StringComparison {CurrentCulture,CurrentCultureIgnoreCase,InvariantCulture,InvariantCultureIgnoreCase,Ordinal, OrdinalIgnoreCase }CurrentC...
分类:
其他好文 时间:
2014-07-30 11:41:23
阅读次数:
161
归并排序的链表法#includeusing namespace std;struct ListNode{ int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {}};class Solution{public:...
分类:
其他好文 时间:
2014-07-30 07:40:23
阅读次数:
174