设为首页 加入收藏

TOP

C - 剪花布条 HDU2087( kmp找子串,子串不能有重叠 )
2015-11-19 23:06:59 来源: 作者: 【 】 浏览:8
Tags:布条 HDU2087 kmp 不能 重叠

C - 剪花布条
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Submit Status

Description
一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢?


Input
输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不再进行工作。


Output
输出能从花纹布中剪出的最多小饰条个数,如果一块都没有,那就老老实实输出0,每个结果之间应换行。


Sample Input
abcde a3
aaaaaa aa
#




Sample Output

0

3

?

#include
  
   
#include
   
     #include
    
      #include
     
       #include
      
        //#include
       
         using namespace std; template
        
         inline T read(T&x) { char c; while((c=getchar())<=32)if(c==EOF)return 0; bool ok=false; if(c=='-')ok=true,c=getchar(); for(x=0; c>32; c=getchar()) x=x*10+c-'0'; if(ok)x=-x; return 1; } template
         
           inline T read_(T&x,T&y) { return read(x)&&read(y); } template
          
            inline T read__(T&x,T&y,T&z) { return read(x)&&read(y)&&read(z); } template
           
             inline void write(T x) { if(x<0)putchar('-'),x=-x; if(x<10)putchar(x+'0'); else write(x/10),putchar(x%10+'0'); } template
            
             inline void writeln(T x) { write(x); putchar('\n'); } //-------ZCC IO template------ const int maxn=1000001; const double inf=999999999; #define lson (rt<<1),L,M #define rson (rt<<1|1),M+1,R #define M ((L+R)>>1) #define For(i,t,n) for(int i=(t);i<(n);i++) typedef long long LL; typedef double DB; typedef pair
             
               P; #define bug printf("---\n"); #define mod 1000000007 int next[maxn]; char a[maxn],b[maxn]; void getnext(char*s) { int i=0,j=-1; next[0]=-1; int len=strlen(s); while(i
              
               

?

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇用C语言编写函数,实现strlen计算.. 下一篇C语言--动态顺序表

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: