首页 > 其他 > 详细

HDU 2087: 剪花布条

时间:2018-07-22 10:13:50      阅读:177      评论:0      收藏:0      [点我收藏+]

HDU 2087: 剪花布条

abcde a3 aaaaaa aa #
0 3
技术分享图片
#include <iostream>
#include <string>  
using namespace std;  
int main(){  
    int j,a;
    string str,temp;  
    while(cin>>str>>temp&&str[0]!=#)  {  
        a=j=0;
        for(int i=0;i<str.size();i++){  
            if(str[i]==temp[j]){  
                j++;  
                if(j==temp.length()){  
                    a++;  
                    j=0;  
                }  
            }  
            else{  
                i-=j;  
                j=0;  
            }  
        }  
        cout<<a<<endl;  
    }  
    return 0;  
}
View Code

 

HDU 2087: 剪花布条

原文:https://www.cnblogs.com/Rhythm-/p/9348900.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!