CodeForces 625B War of the Corporations
来源:互联网 发布:连接视频的软件 编辑:程序博客网 时间:2024/04/29 05:57
题目:http://codeforces.com/problemset/problem/625/B
代码:
#include<stdio.h>#include<string.h>using namespace std;int main(){ char a[100005]; char b[135]; while(~scanf("%s%s",a,b)) { int x=0; int ans=0; for(int i=0; i<strlen(a); i++) { ans=0; int k=i; if(a[i]==b[0]){ for(int j=0; j<strlen(b); j++) { if(a[k]==b[j]) { k++; ans++; } } if(ans==strlen(b)) { x++; //a[i+strlen(b)-1]='0'; i=i+strlen(b)-1; //printf("%d\n",i); }} } printf("%d\n",x); memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); }}
看完别人的代码后受到了惊吓。
代码:
#include<bits/stdc++.h>using namespace std;string s,s1;int n,m,n1,x,t,y;main(){ cin>>s>>s1; x=s.find(s1); for(; x>=0;) { t++; x=s.find(s1,x+s1.size()); } cout<<t;}
0 0
- Codeforces 625B - War of the Corporations
- CodeForces 625B War of the Corporations
- CodeForces 625B - War of the Corporations
- Codeforces 625B War of the Corporations 【暴力】
- CodeForces 625 B. War of the Corporations(水~)
- CodeForces 625B War of the Corporations(KMP)
- 【38.02%】【codeforces 625B】War of the Corporations
- B. War of the Corporations
- Codeforces Round #342 (Div. 2)--B. War of the Corporations
- Codeforces Round #342 (Div. 2)-B. War of the Corporations
- Codeforces Round #342 (Div. 2) 625B War of the Corporations(stl)
- Codeforces 625B War of the Corporations (字符串匹配题目)
- HDU 4150 Powerful Incantation / Codeforces 625B - War of the Corporations
- cf 625 b.War of the Corporations (字符串)
- cf#342-B - War of the Corporations
- Codeforces Round #342 (Div. 2)-B. War of the Corporations(模拟)
- coderforces342B. War of the Corporations【strstr】
- War of the Corporations(字符串子串的查找)
- 134.Where can subqueries be used? (Choose all that apply.)
- WebRTC Android API
- excel poi 批量导入源码
- Core Animation - 寄宿图<二>
- BitmapFactory.Options
- CodeForces 625B War of the Corporations
- MYSQL 连接数据库命令收藏
- 通过storyboard自定义绘制View
- (3)Vigenere密码算法的Java实现
- Android 程序框架设计
- 杭电1003Max Sum
- 线段数求和模板
- Java编程入门
- 让32位Eclipse和64位Eclipse同时在64的Windows7上运行