摘要: #include typedef struct node{ char name[24]; char id[19]; int num; node * pre; node * next; }node; node nhs[100004]; node ihs[100004]; node ihspool[100004]; int iindex = 0; node ... 阅读全文
posted @ 2017-12-20 10:31 Mr.Struggle 阅读(468) 评论(0) 推荐(0) 编辑
摘要: 本帖主要内容转自:https://www.61mon.com/index.php/archives/183/ next函数 优化的next函数 Kmp算法 阅读全文
posted @ 2017-09-25 23:34 Mr.Struggle 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 预备函数: 将参数转化为二进制数后最后一位1所在的位置,并将此位置上的1转化为十进制。 修改数据: 修改原始数据某一元素的值 求前k项和: 只需要把e(k)以及其前驱结点的值累加即可 阅读全文
posted @ 2017-09-19 16:56 Mr.Struggle 阅读(113) 评论(0) 推荐(0) 编辑
摘要: struct BinarySearchTree { Node* search(Node* node, int key) { while (nil != node && key != node->key) { if (key key) { node = node->leftChild; } else { node = node->rightChild; } ... 阅读全文
posted @ 2017-09-18 15:58 Mr.Struggle 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 之前写过一个数字的稍作修改便可以AC,对于题目要求以文本结束则结束程序需要输入不为EOF即可。 阅读全文
posted @ 2017-09-12 15:05 Mr.Struggle 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 题目难点在于对两片雪花的比较,哈希可以加快搜索速度,防止超时,而对于如何逆时针和顺时针比较雪花是否相同便成为重点。 在这里给出两条公式: 设i为A、B的第i片叶子,j为B当前顺时针转过的格数 那么 A(i) > B( (i+j)%6 ) 设i为A、B的第i片叶子,j为B当前逆时针转过的格数 那么 A 阅读全文
posted @ 2017-09-08 10:27 Mr.Struggle 阅读(122) 评论(0) 推荐(0) 编辑
摘要: int ELFhash(char *key){ unsigned long h=0; unsigned long x=0; while(*key) { h=(h>24); //清空28~31位 h&=~x; } } return h % N; } 阅读全文
posted @ 2017-09-07 11:49 Mr.Struggle 阅读(210) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; typedef struct node{ int data; int qnum; struct node * next; }node; typedef struct Linkqueue{ node * front; node * rear; }Linkqueue... 阅读全文
posted @ 2017-09-06 19:23 Mr.Struggle 阅读(188) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; typedef struct Node{ int info; Node * link; }Node; typedef struct LinkStack{ Node * top; }LinkStack; int push(LinkStack * stack, int x){ Node * p = new Node; p-... 阅读全文
posted @ 2017-09-06 19:22 Mr.Struggle 阅读(149) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; #define MAX 101 int data[MAX][MAX]; int n; int maxSum[MAX][MAX]; int main(){ cin>>n; for(int i=1;i>data[i][j]; for(int i=1;i=1;i--) for(int j=1;j=maxSum[i+1][j+1... 阅读全文
posted @ 2017-09-05 11:11 Mr.Struggle 阅读(119) 评论(0) 推荐(0) 编辑