2012年11月12日

摘要: kmp的题,这题比较简单。题意大概是,在一个串中找另一个串出现的次数。下面是我ac之后的代码,时间比较长了点,78ms。ac代码:View Code #include <algorithm>#include <iostream>#include <stdlib.h>#include <string.h>#include <limits.h>#include <stdio.h>#include <math.h>#include <vector>#include <queue>#includ 阅读全文
posted @ 2012-11-12 15:48 Raining Days 阅读(133) 评论(0) 推荐(0) 编辑

2012年11月8日

摘要: 之前发现把题目的网页复制过来显的文章不太好,以后就不这么做了。杭州回来跟死了一样,发誓我要踏踏实实一步一步来。 这个题是kmp的题,题目意思大概是对于原串中的每个前缀,找这个前缀在原串中出现过几次,对每个前缀都这么做,并用一个计数器来累加,最后要输出的就是这个结果%10007。这个题我tle了一次,主要是现在已经懒得算什么时间复杂度了,之前赛场上我队友非要n^2搞一个一百亿的数据量,我无语到吐血。。。tle代码:主要思想就是搞出来每个前缀并与原串进行KMP,时间复杂度不是很清楚,反正是挂掉了。后来自己胡乱想了一个想法,就是next数组搞出来的是前后缀问题,那么我就可以考察next数组,看对于. 阅读全文
posted @ 2012-11-08 16:22 Raining Days 阅读(164) 评论(0) 推荐(0) 编辑

2012年10月11日

摘要: Alice and BobTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1253Accepted Submission(s): 478Problem DescriptionAlice and Bob's game never ends. Today, they introduce a new game. In this game, both of them have N different rectangular cards res 阅读全文
posted @ 2012-10-11 19:59 Raining Days 阅读(213) 评论(0) 推荐(0) 编辑
摘要: Jamie's Contact GroupsTime Limit: 15000/7000 MS (Java/Others)Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 225Accepted Submission(s): 63Problem DescriptionJamie is a very popular girl and has quite a lot of friends, so she always keeps a very long contact list in her cell phone. 阅读全文
posted @ 2012-10-11 09:02 Raining Days 阅读(279) 评论(0) 推荐(0) 编辑

2012年10月1日

摘要: 题目链接:http://poj.org/problem?id=1240好久之前自己写的,今天拿出来看看,越看越喜欢。题目意思,已知前序遍历跟后序遍历,求树共有多少种形态。前一篇随笔中提到了一点。View Code #include <iostream>#include <stdio.h>#include <string.h>#include <stdlib.h>using namespace std;const int maxn=27;char s1[maxn],s2[maxn];int m,ans,pre;int zuhe(int cnt){ 阅读全文
posted @ 2012-10-01 14:31 Raining Days 阅读(227) 评论(0) 推荐(0) 编辑

导航