CodeForces 625B - War of the Corporations
2016-03-15 22:52
495 查看
字符串匹配
#include <cstdio> #include <iostream> #include <cstring> const int MAX = 1e5 + 5; char arr1[MAX], arr2[35]; int main() { scanf("%s%s", arr1, arr2); int lenth1 = strlen(arr1), lenth2 = strlen(arr2), cnt = 0; for (int i = 0; i < lenth1; ++i) { int tmp = i; for (int j = 0; j < lenth2; ++j) { if (arr1[tmp] != arr2[j]) { break; } ++tmp; if (j == lenth2 - 1) { cnt++; i = tmp - 1; } } } printf("%d\n", cnt); return 0; }
相关文章推荐
- root = Tk() 和 root = Tkinter.Tk() 区别
- 安卓第十四天笔记-内容提供者(ContentProvider)
- Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes
- SLIC Superpixels 算法学习笔记
- CodeForces 625A - Guest From the Past
- 第六章:JavaScript面向对象编程
- 计算1!+2!+.....+20!的和
- C++ 虚函数表解析
- 17. Letter Combinations of a Phone Number LeetCode
- Aizu - 0189 Convenient Location(floyd)
- Spring常用注解
- 217. Contains Duplicate
- liunx系统下 锐捷使用以及虚拟拨号教程
- 统计细胞数量
- 基于windows IIS的C语言CGI WEB服务器环境搭建
- 算导--7-2-b.构造新的PARTITION'(A, p, r)
- Struts2 中 模板驱动ModelDriven
- JavaWeb不用选择结构直接引用资源文件
- JNI 实战全面解析
- Android性能优化系列