首页 > 其他 > 详细

hdu 4847 Wow! Such Doge! 水题

时间:2015-05-20 20:18:57      阅读:111      评论:0      收藏:0      [点我收藏+]

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4847

 

统计文本中一共有多少个“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;
}

 

hdu 4847 Wow! Such Doge! 水题

原文:http://www.cnblogs.com/dishu/p/4517967.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!