17999 Light-bot 模拟 + kmp求循环节】的更多相关文章

http://acm.scau.edu.cn:8000/uoj/mainMenu.html 17999 Light-bot 时间限制:1000MS  内存限制:65535K 提交次数:0 通过次数:0 题型: 编程题   语言: 不限定 Description I (you needn't know who am "I".) am currently playing a game called "Light-bot". In the game, the "…
Problem - 3374   KMP求循环节. http://www.cnblogs.com/wuyiqi/archive/2012/01/06/2314078.html   循环节推导的证明相当的好,这题是很裸的套算法的题. 代码如下: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; ; char buf…
题目描述 E.T. Inc. employs Maryanna as alien signal researcher. To identify possible alien signals and background noise, she develops a method to evaluate the signals she has already received. The signal sent by E.T is more likely regularly alternative. …
题目: 看起来比较难,范围10^9 O(n)都过不了,但是仅仅是看起来.(虽然我WA了7次 TLE了3次,被自己蠢哭) 我们观察到 0 <= f[i] <= 6 就简单了,就像小学初中学的找到循环节然后求第n项. 我们只用记录下两个连续的数字重复出现,就找到了循环节,然后就简单了. 注意:MOD函数是用于返回两数相除的余数,返回结果的符号与除数(divisor)的符号相同.(来自百度百科) ,mod结果正负所以要与7正负相同. 代码(详细注释): #include <bits\stdc+…
求next数组,(一般有两种,求循环节用的见代码)求出循环节的长度. #include <cstdio> #define N 100005 int n,next[N]; char s[N]; int main(){ scanf("%d",&n); while(n--){ scanf("%s",s); int i=0,k=-1; next[0]=k; while(s[i]){ if(k==-1||s[i]==s[k]) { i++; k++; ne…
CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about how to tide over the last days. Being inspired by the en…
Cyclic Nacklace Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4735    Accepted Submission(s): 2165 Problem Description CC always becomes very depressed at the end of this month, he has checked…
题意就是将所给的字符串变成多个完整的循环(至少两个),然后给出最少需要添加的字符数.…
链接 http://acm.hdu.edu.cn/showproblem.php?pid=1358 思路 当初shenben学长暑假讲过,当初太笨了,noip前几天才理解过来.. 我也没啥好说的 代码 #include <iostream> #include <cstdio> #include <cstring> using namespace std; const int N=1e6+7; int n,len,fail[N]; char s[N]; void get_…
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=70325#problem/F The Minimum Length Time Limit:1000MS     Memory Limit:131072KB     64bit IO Format:%lld & %llu Submit Status Practice HUST 1010 Description There is a string A. The length of A is…