摘要:http://poj.org/problem?id=2752水题一枚:next函数应用View Code 1 #include<stdio.h> 2 #include<string.h> 3 char str1[500005]; 4 int next[500005]; 5 int a[500005]; 6 void get_next(int x) 7 { 8 int i=0,j=-1; 9 next[0]=-1;10 while(i<x)11 {12 if(j==-1||str1[i]==str1[j])13 {14 ...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2594View Code 1 #include<stdio.h> 2 #include<string.h> 3 char str1[100010]; 4 char str2[50005]; 5 int next[1000010]; 6 int max(int x,int y) 7 { 8 return x=x>y?x:y; 9 }10 void get_next(int x)11 {12 13 int i=0,j=-1;14 next[0]=-1;15 while(i...
阅读全文
摘要:PeriodTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1326Accepted Submission(s): 637Problem DescriptionFor each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether
阅读全文
摘要:View Code 1 #include<stdio.h> 2 #include<string.h> 3 char str[1000010]; 4 int next[1000010]; 5 int get_next(int x) 6 { 7 int i=0,j=-1; 8 next[0]=-1; 9 while(i<x)10 {11 if(j==-1||str[i]==str[j])12 {13 i++;14 j++;15 if(str[i]!=str[j]...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1686OulipoTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2553Accepted Submission(s): 986Problem DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1711Number SequenceTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5807Accepted Submission(s): 2608Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2087剪花布条Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4547Accepted Submission(s): 3061Problem Description一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢?Input输入中含有一些数据,分别是成对出现的花布条和小
阅读全文