- 博客(7)
- 收藏
- 关注
原创 线段树hdu1754 I Hate It
#include #define LL(a) ((a)<<1) #define RR(a) ((a)<<1|1) #define N 600001 #define MAX(a,b) (((a) > (b)) ? (a):(b)) //inline int MAX(int a, int b){return ((a > b) ? a:b);} typedef struct NodeTag {
2012-05-11 11:56:17 534
原创 链表归并排序
#include #include #include #include //#include //using namespace std; typedef int TYPE; typedef struct NODETAG { struct NODETAG* pNext; TYPE value; } NODE; NODE* build(TYPE A[], int n)
2012-05-08 11:49:51 618
原创 逆序数Sicily 5142. Inversion Number
// // main.cpp // algorithm // // Created by Calvin Zang on 12-5-5. // Copyright (c) 2012年 SYSU. All rights reserved. // #include #include #include #include typedef int TYPE; #define N 10000
2012-05-07 20:23:18 787
原创 计算两个字符串的距离(相似度)
#define min(a,b) (((a)<(b)) ? (a) : (b)) int stringDistance(char strA[], int pABegin, int pAEnd, char strB[], int pBBegin, int pBEnd) { if(pABegin > pAEnd){ if(pBBegin > pBEnd) return 0;
2012-05-07 20:19:05 771
原创 线段树2 POJ2777 Count Color
http://poj.org/problem?id=2777 #include #include #define LCH(a) ((a)<<1) #define RCH(a) (((a)<<1)+1) #define NO_COLOR 0 typedef struct nodetag{int st, ed, value;} node; node valtree[400000]; in
2012-05-06 16:25:44 441
原创 第一道线段树hdu1166
#include #define LL(a) ((a)<<1) #define RR(a) ((a)<<1|1) typedef struct nodetag{int st, ed, value;} node; node valtree[200002]; void init(int place, int st, int ed) { int mid = (st+ed)/2;
2012-05-06 16:22:16 415
原创 冒泡排序bubbleSort
#include #include #include typedef int TYPE; #define N 100 void exchange(TYPE A[], int i, int j){TYPE tmp = A[i]; A[i]=A[j];A[j]=tmp;} void bubbleSort(TYPE A[], int n) { int i, j; for(i =
2012-05-05 21:45:20 421
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人