链接:

http://acm.hdu.edu.cn/showproblem.php?pid=4847

题意:

Now, Doge wants to know how many words “doge” are there in a given article. Would you like to help Doge solve this problem?

思路:

暴力完事

代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
//#include <memory.h>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <math.h>
#include <stack>
#include <string>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <sstream>
#define MINF 0x3f3f3f3f
using namespace std;
typedef long long LL;
const int MAXN = 1e6+10; char s[MAXN]; bool Check(int p)
{
if (s[p] != 'd' && s[p] != 'D')
return false;
if (s[p+1] != 'o' && s[p+1] != 'O')
return false;
if (s[p+2] != 'g' && s[p+2] != 'G')
return false;
if (s[p+3] != 'e' && s[p+3] != 'E')
return false;
return true;
} int main()
{
int ans = 0;
while (gets(s))
{
int len = strlen(s);
for (int i = 0;i < len;i++)
if (Check(i))
ans++;
}
cout << ans << endl; return 0;
}

HDU-4847-Wow!Such Doge!(嘿嘿嘿, 水题)的更多相关文章

  1. HDU 4847 Wow! Such Doge!

    Wow! Such Doge! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  2. Wow! Such Doge! HDU - 4847(虽然是道水题 但很有必要记一下)

    就是求出现了多少次doge 不区分大小写  巧用字符串函数 isalpha 判断是否是字母 tolower 转换为小写字母 toupper 转换为大写字母 strncmp字符串比较函数  能限制比较的 ...

  3. HDOJ(HDU) 4847 Wow! Such Doge!(doge字符统计)

    Problem Description Chen, Adrian (November 7, 2013). "Doge Is An Ac- tually Good Internet Meme. ...

  4. HDU 2096 小明A+B --- 水题

    HDU 2096 /* HDU 2096 小明A+B --- 水题 */ #include <cstdio> int main() { #ifdef _LOCAL freopen(&quo ...

  5. [HDU 2602]Bone Collector ( 0-1背包水题 )

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602 水题啊水题 还给我WA了好多次 因为我在j<w[i]的时候状态没有下传.. #includ ...

  6. hdu 2117:Just a Numble(水题,模拟除法运算)

    Just a Numble Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tot ...

  7. hdu 2050:折线分割平面(水题,递归)

    折线分割平面 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  8. hdu 2044:一只小蜜蜂...(水题,斐波那契数列)

    一只小蜜蜂... Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepte ...

  9. HDU 4706 Children's Day (水题)

    Children's Day Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...

随机推荐

  1. [转帖]linux各种IPC机制

    linux各种IPC机制 docker中的资源隔离,一种就是IPC的隔离.IPC是进程间通信. 下面的文章转载自https://blog.csdn.net/yyq_9623/article/detai ...

  2. scrapy-redis数据去重与分布式框架

    数据去重 生成指纹:利用hashlib的sha1,对request的请求体.请求url.请求方法进行加密,返回一个40位长度的16进制的字符串,称为指纹 fp = hashlib.sha1() fp. ...

  3. C++ Primer练习题day2

    /* 1.7略 1.8 /* 指出不合法的语句: std::cout<<"/"; std::cout<<"*/ "; std::cout ...

  4. ubuntu 拨号上网

    如果没有安装的用户,可以使用 sudo apt-get install pppoe pppoeconf 然后配置上网 sudo pppoeconf 最后,使用 sudo pon dsl-provide ...

  5. C/C++快读(快速读入)有多——安全AC

    在一些算法题目中中,有的程序会被卡常(数),就是说,程序虽然渐进复杂度,(通俗来讲:算法的时间复杂度)可以接受,但因为算法本身的时间常数过大,导致程序在一些算法竞赛中超时.这是,快读就显得尤为重要了. ...

  6. Go语言GOPATH详解(Go语言工作目录)

    GOPATH 是 Go语言中使用的一个环境变量,它使用绝对路径提供项目的工作目录. 工作目录是一个工程开发的相对参考目录,好比当你要在公司编写一套服务器代码,你的工位所包含的桌面.计算机及椅子就是你的 ...

  7. 怎样理解 display:none 和 visibility:hidden

    1. display: none会使元素节点 "消失" , 就像 死亡后灰飞烟灭了. 它是不占位置的. 2. visibility: hidden会使元素节点 "隐藏&q ...

  8. Google开源项目风格指南

    Google开源项目风格指南 来源 https://github.com/zh-google-styleguide/zh-google-styleguide Google 开源项目风格指南 (中文版) ...

  9. scala的泛型浅析

    1. scala泛型浅析 package com.dtspark.scala.basics /** * 1,scala的类和方法.函数都可以是泛型. * * 2,关于对类型边界的限定分为上边界和下边界 ...

  10. 给datagrid一列中的数据加上单位

    { field:'computeRate', title:'完成百分比', width:100, align:'center', halign:'center', sortable:true, for ...