博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
西电网络赛 - C
阅读量:6982 次
发布时间:2019-06-27

本文共 1083 字,大约阅读时间需要 3 分钟。

#include 
using namespace std;/**************************************************************************************************************** 题意: 在主串中寻找子串出现的个数 思路: 1,千万别用 两个 for,绝对超时 2,用书上的算法或者 KMP,不会KMP。 3,因为输入有点坑,所以每跑完一组数据之后一定要清除串S****************************************************************************************************************/string s[105];string temp = "wanshen";int main(){ int T; while(cin>>T) { string S; int num; for(int i = 0;i < T;i ++){ cin>>s[i]; S+=s[i]; } int i=0,j; num=0; while(i < S.size()) { j=0; if(S[i] == temp[j]){ while(S[i] == temp[j] && j < temp.size()) { i++; j++; } } else i++; if(j == temp.size()) num++; } cout<
<

转载于:https://www.cnblogs.com/Jstyle-continue/p/6352014.html

你可能感兴趣的文章
SCCM 2012 SP1系列(一)先决条件准备-1
查看>>
shell 逻辑运算符、逻辑表达式详解
查看>>
Linux下安装jboss(续集)
查看>>
双硬盘双系统启动
查看>>
【NetApp】SVM管理员如何使用system manager GUI界面管理SVM
查看>>
office常用的快捷键
查看>>
JavaScript语法详解(一)
查看>>
zimbra mailbox 备份与恢复
查看>>
【18】Python半成品购物车
查看>>
RedHat Linux KVM安装配置
查看>>
01 jquery easyui 入门示例
查看>>
oracle rac 扩展磁盘采坑记录
查看>>
Deprecated:function eregi() is deprecated in /usr/local/apache/libraries/lib_lang.php on line 8
查看>>
2.shell前基础知识
查看>>
resin4 配置https
查看>>
mysql备份脚本
查看>>
monit安装
查看>>
为什么你的服务器被列入垃圾邮件?
查看>>
游戏角色动作太羞耻?现在AI能帮忙了(也有论文)
查看>>
phpcms 调用多级栏目和多级栏目下的文章列表
查看>>