摘要:
#include<bits/stdc++.h> #define MaxSize 100 using namespace std; typedef struct TreeNode {//定义二叉树结构 char Data; struct Node *lchild,*rchild; }*BiTree,B 阅读全文
摘要:
typedef struct LNode *List; struct LNode{ int Data[MAXSIZE]; int Last;//最后一个,表长为last+1 }; struct LNode L; List PtrL; List MakeEmpty(){ List PtrL; PtrL 阅读全文
摘要:
kmp,next带优化 #include<iostream> #include<bits/stdc++.h> using namespace std; void getnext(char p[],int next[]){ next[0]=-1; int i=0,j=-1; int n=strlen( 阅读全文
摘要:
#include<bits/stdc++.h> #define MaxSize 100 using namespace std; typedef struct Node {//定义二叉树结构 char data; struct Node *lchild,*rchild; }*BiTree,BiTNo 阅读全文
摘要:
#include <iostream> #include <cstdio> #include<bits/stdc++.h> using namespace std; //栈 typedef struct{ int *base; int *top; int stacksize; }sqstack; v 阅读全文
摘要:
https://blog.csdn.net/Endeavor_G/article/details/80552680 https://blog.csdn.net/qq_39993896/article/category/7319745 这个详细 顺序表:https://blog.csdn.net/la 阅读全文
摘要:
中文题意: 思路:我们先看看能不能直接从x翻到y,abs(y-x)%d==0,可以就直接输出abs(y-x)/d咯,不行的话之后有2种操作 1.先翻回到第一页,从第一页看看能不能范到y,不能的话翻到最后一页,倒回来翻看看能不能翻到y,不能的话这种方法不行; 2.翻到最后一页,倒回来看看能不能翻到y, 阅读全文
摘要:
题意:求最长可以分a b a为三部分子串,a b a可以为空 思路在代码里 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #include<cmath> 5 #include<algorithm> 6 #define ma 阅读全文
摘要:
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1536 典型尼姆题,直接sg模板搞 之前mex设为int,怎么都TE过不了,看了讨论之后说设为bool就过了,但是我不知道为什么,是bool更快吗??? ac代码: 1 #include<cstdio> 2 阅读全文
摘要:
题意:就是给一n(奇数)个元素数组,可以对它的元素执行k次+1操作,递增排序,求中位数最大是多少。 那我们在排完序之后,中位数前的元素可以不管它,只要对中位数后的操作就行,我们要判断和中位数相等的元素有几个,再用k减去它,循环一下,当k小于0时没的减了,也就是数组元素不能再加了时跳出来。 附ac代码 阅读全文