解:代码如下 (define?(sum?term?a?next?b)
??(if?(>?a?b)
??????0
??????(+?(term?a)?(sum?term?(next?a)?next?b))))
(define?(add-1?x)
??(+?x?1))
(define?(sum-iter...
分类:
其他好文 时间:
2014-08-22 00:27:35
阅读次数:
202
简单写了一点分页的功能,没有注释没有完成啥都没有,只是写了一下思路..待续 templateUrlprev{{item}}next 后期想实现的功能是,直接给page的directive数据源和需要显示的条数,directive提供接口返回当前页的数据,然后再把数据给另外一个显示...
分类:
Web程序 时间:
2014-08-22 00:19:55
阅读次数:
306
题目:求一个串的最大的循环次数。
分析:dp,KMP,字符串。这里利用KMP算法。
KMP的next函数是跳跃到最近的串的递归结构位置(串元素取值0 ~ len-1);
由KMP过程可知:
如果存在循环节,则S[0 ~ next[len]-1] 与 S[len-next[len] ~ len-1]相匹配;
...
分类:
其他好文 时间:
2014-08-21 22:48:45
阅读次数:
343
1, LinkedListcomposed of one and one Node: [data][next].[head] ->[data][next] ->[data][next] ->[data][next] -> [null].Empty linkedList: head == null.V...
分类:
其他好文 时间:
2014-08-21 22:46:14
阅读次数:
229
//来自潘神的优化
#include
#include
#include
using namespace std;
#define inf 0x3fffffff
#define N 1100
struct node {
int u,v,w,next;
}bian[N*N*4];
int head[N],yong,dis[N],work[N];
void init(){
yong=0;
memset...
分类:
其他好文 时间:
2014-08-21 21:13:14
阅读次数:
238
1.链表1.1链表的存储表示//链表的存储表示typedef int ElemType;typedef struct LNode{ ElemType data; struct LNode *next;}LNode, *LinkList;1.2基本操作创建链表:/* * 创建链表。 * 形参num为链...
分类:
其他好文 时间:
2014-08-21 21:01:14
阅读次数:
221
题解:将原来的串扩展为两倍,然后用KMP匹配。#include #include char str[200005],pat[100005];int next[100005],N,M;void getnext(){ int i=1,j=0;next[1]=0; while(iM)retur...
分类:
其他好文 时间:
2014-08-21 20:54:54
阅读次数:
197
翻译自stackoverflow英语好的同学可以自己去看一下。什么是next permutation 下面是四个元素{1,2,3,4}的排列1 2 3 41 2 4 31 3 2 41 3 4 21 4 2 31 4 3 22 1 3 4... 每一行都是一个排列。 我们如何从一个排列转到下一...
分类:
其他好文 时间:
2014-08-21 17:01:44
阅读次数:
228
#include #include #include #include #include using namespace std;const int maxn=500,maxm=maxn*maxn;int next[maxm*2],num[maxm*2],r[maxm*2],a[maxn*2],ro...
分类:
其他好文 时间:
2014-08-21 16:33:34
阅读次数:
147
//枚举函数调用//#include static main(){ auto func,end,target,inst,name,flags,xref; flags = SEARCH_DOWN | SEARCH_NEXT; func = GetFunctionAttr(ScreenEA(),FUNC...
分类:
其他好文 时间:
2014-08-21 09:41:33
阅读次数:
280