hdu 4847 Wow! Such Doge! 水题
2015-05-20 19:21
330 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4847
统计文本中一共有多少个“Doge”
水题
统计文本中一共有多少个“Doge”
水题
#include <cstring> #include <cstdlib> #include <cstring> #include <cmath> #include <algorithm> #include <iostream> #include <cstdio> #include <stack> #include <vector> #include <queue> #include <map> #include <set> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; const int maxn = 500100; char a[maxn]; const char ch[] = "doge"; int main() { //freopen("in.txt", "r", stdin); int ans = 0; while(scanf("%s", a) == 1) { int len = strlen(a); int loc = 0; for(int i = 0; i < len; i++) { if('A' <= a[i] && a[i] <= 'Z') a[i] = a[i] - ('A' - 'a'); if(a[i] == ch[loc]) loc++; else { loc = 0; if(a[i] == ch[loc]) loc++; } if(loc >= 4) { ans++; loc = 0; } } } printf("%d\n", ans); return 0; }
相关文章推荐
- Wow! Such Doge! - HDU 4847 (水题)
- hdu 4847 Wow! Such Doge!(水题)
- HDU-4847-Wow! Such Doge!
- HDU 4847 Wow! Such Doge! (注意输入格式!)
- HDU-4847:Wow! Such Doge!(震惊!!!kmp模板题。。。kmp:我不要面子的啊)
- HDU-4847 Wow! Such Doge!,模拟!
- HDU 4847-Wow! Such Doge!(定位)
- HDU 4847-Wow! Such Doge!(签到)
- HDU 4847 Wow! Such Doge!
- HDU 4847 Wow! Such Doge!(模拟)
- HDU 4847 Wow! Such Doge!【简单题】
- 简单题(需要注意一个细节) 之 hdu 4847 Wow! Such Doge!
- hdu 4847 Wow! Such Doge!
- 简单题(需要注意一个细节) 之 hdu 4847 Wow! Such Doge!
- HDU 4847 Wow! Such Doge!
- HDOJ(HDU) 4847 Wow! Such Doge!(doge字符统计)
- HDOJ(HDU) 4847 Wow! Such Doge!(doge字符统计)
- hdu 4847 Wow! Such Doge!
- HDU-4847 Wow! Such Doge!
- Wow! Such Doge!(模拟水题)