hdu2087
#include <stdio.h>
#include <string.h>
int main(){
int cnt,i,j,k;
char str[+],tmp[+];
int strl,tmpl;
while(~scanf("%s",str)){
if(!strcmp(str,"#")) break;
scanf("%s",tmp);
cnt=;
strl=strlen(str); tmpl=strlen(tmp);
for(i=;i<strl;++i){
for(j=,k=i;j<tmpl;++j,++k){
if(k>=strl) break;
if(str[k]==tmp[j])
continue;
else
break;
}
if(j==tmpl){
cnt++;
i=k-;
}
}
printf("%d\n",cnt);
}
return ;
}
hdu2087的更多相关文章
- HDU-2087 剪花布条 字符串问题 KMP算法 查匹配子串
题目链接:https://cn.vjudge.net/problem/HDU-2087 题意 中文题咯 一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案.对于给定的花布条和小饰条, ...
- 剪花布条[HDU2087]
剪花布条 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- 【HDU2087】KMP
KMP算法其实很好理解,就是在匹配串中找最近的相同的串. 下面是HDU的2087: #include<iostream> #include<cstdio> #include&l ...
- HDU-2087 剪花布条
http://acm.hdu.edu.cn/showproblem.php?pid=2087 剪花布条 Time Limit: 1000/1000 MS (Java/Others) Memory ...
- hdu-2087(kmp)
题意:模板题,在第一个串中有几个第二个串 解题思路:板子题,拿来练手的: 代码: #include<iostream> #include<algorithm> #include ...
- hdu2087 剪花布条
剪花布条 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...
- hdu2087 剪花布条 暴力/KMP
在字符串中不可重叠地寻找子串数量,暴力/KMP #include<stdio.h> #include<string.h> int main(){ ],b[]; ]!='#'){ ...
- 剪花布条---hdu2087(kmp模板)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2087 kmp模板题: #include <cstdio> #include <cst ...
- kuangbin专题十六 KMP&&扩展KMP HDU2087 剪花布条
一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案.对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input输入中含有一些数据,分别是成对出现的花布条和小 ...
- [hdu2087]剪花布条(KMP)
题意:求存在模式串个数,不可重复. 解题关键:模板题.整理模板用.重复和不可重复的区别在下面已标出.主要是j的变化. #include<cstdio> #include<cstrin ...
随机推荐
- leetcode287 Find the Duplicate Number
思路: 转换成链表之后使用floyed判环法.转换之后重复的那个数字是唯一一个有多个前驱和一个后继的节点,因此是环的起始节点. 实现: class Solution { public: int fin ...
- pingall脚本
p i n g a l l:一个按照/ e t c / h o s t s文件中的条目逐一p i n g所有主机的脚本 它能够按照/ e t c / h o s t s文件中的条目逐一p i n g所 ...
- GoAccess参数选项
GoAccess - 1.2 Usage: goaccess [filename] [ options ... ] [-c][-M][-H][-q][-d][...]The following opt ...
- codevs 5462 HYY迎亲I
时间限制: 1 s 空间限制: 256000 KB 题目等级 : 青铜 Bronze 题目描述 Description HYY要娶山那头的JCH,可毕竟是山路,十分崎岖,他又十分的单(bai)纯(ch ...
- [习题]输入自己的生日(年/月/日)#2 -- 日历(Calendar)控件的时光跳跃,一次跳回五年、十年前?--TodaysDate属性、VisibleDate属性
原文出處 http://www.dotblogs.com.tw/mis2000lab/archive/2013/06/10/calendar_visibledate_birthday_dropdow ...
- mac重启privoxy命令
重启命令 brew services restart privoxy
- 几个不错的APP网站。
http://www.yunshipei.com/yunshipei.html http://www.appcan.cn/
- C# 重写(override)和覆盖(new)
重写 用关键字 virtual 修饰的方法,叫虚方法.可以在子类中用override 声明同名的方法,这叫“重写”.相应的没有用virtual修饰的方法,我们叫它实方法.重写会改变父类方法的功能. ...
- Robot Framework(十) 执行测试用例——测试执行
3.2测试执行 本节描述如何执行从解析的测试数据创建的测试套件结构,如何在失败后继续执行测试用例,以及如何正常停止整个测试执行. 3.2.1执行流程 执行套房和测试 设置和拆卸 执行顺序 3.2.2继 ...
- cdlinux
xset q xset s 6000 xset -dpms ntpdate time.nist.gov date