hdu4847 Wow!Such Doge!【字符串】【暴力】

Wow! Such Doge!

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3816    Accepted Submission(s): 2254

Problem Description


Chen, Adrian (November 7, 2013). “Doge Is An Ac- tually Good Internet Meme. Wow.”. Gawker. Retrieved November 22, 2013.

Doge is an Internet meme that became popular in 2013. The meme typically con- sists of a picture of a Shiba Inu dog ac- companied by multicolored text in Comic Sans MS font in the foreground. The text, representing a kind of internal monologue, is deliberately written in broken English, and usually contains the word “wow” and the phrases “such x”, “much x”, “many x”, “very x” and “so x”.
Kabosu, the Shiba Inu featured in the original meme, was first pictured in a 2010 blog post by Atsuko Sato, a Japanese kindergarten teacher. Afterwards, varia- tions of the pictures using overlaid Comic Sans text were posted from a Tumblr blog, Shiba Confessions. However, the use of the intentionally misspelled “doge” dates back to June 2005, when it was mentioned in an episode of Homestar Runners puppet series.
In August 2013, images of the meme were spammed on Reddit’s r/MURICA subreddit by 4chan’s random imageboard, /b/. A search of the term doge on Google Trends shows an explosion of popularity occurring in October 2013, and more so in the following month. By November 2013, the meme had become widespread on the Internet. Google later created a Doge Easter egg: when doge meme was entered into the YouTube search bar, all of the site’s text would be displayed in colorful Comic Sans, similar to the kind used by the meme.
The meme was ranked #12 on MTV’s list of “50 Things Pop Culture Had Us Giving Thanks For” in 2013. Io9 compared the internal dialog of the Shiba Inu dogs to lolcat-speak. The image most commonly associated with the meme is of a female Shiba Inu named Kabosu, taken from a Japanese blog documenting the dog’s daily activities. The spelling of doge has several variants, leading to debate on its actual pronunciation. On December 13, Doge was named the “top meme” of 2013 by Know Your Meme.
In December 2013, the Dogecoin was introduced as a new cryptocurrency, making it the first cryptocurrency to be based on an Internet meme; the viral phenomenon, along with usage of the Comic Sans MS typeface, gave it “the Internet density of a large star” according to Medium writer Quinn Norton.
In late December 2013, members of the U.S. Congress produced material in the meme’s style. Huffington Post commented that Doge was “killed” because of the Congress members’ usage of the meme.
By early 2014, Doge’s popularity was sustained by internet communities on social media, accompanied by the rapid growth and acceptance of Dogecoin. In April 2014, Doge experienced a second major media resurgence due to revelations of the Dogecoin community’s intent to sponsor Josh Wise in NASCAR and place a picture of the Shiba Inu on his vehicle.

—— Doge (meme). (2014, May 18).
In Wikipedia, The Free Encyclopedia. Retrieved 02:00, May 22, 2014, from
http://en.wikipedia.org/w/index.php?title=Doge_(meme)&oldid=609040691

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

Input

An article that Doge wants to know.
The size of the article does not exceed 64KB. The article contains only ASCII characters.

Output

Please output the number of word “doge” (case-insensitive). Refer to the samples for more details.

Sample Input

adoge
cutedo
yourge
blownDoge
lovelyDooge
Wow! Such Dooooooooooooooge!!!
D0ge
dOge DOGE
dogedoge

Sample Output

6

Source

2014西安全国邀请赛

Recommend

liuyiding

题意:

题目也太长了,之前都不敢去看。其实有用的就最后一句话。

判断给定的文本中出现了多少次“doge”这个单词,大小写不敏感。

思路:

暴力跑一下连着的4个字符是不是“doge”就行了。

因为大小写不敏感所以首先把大写变成小写。用string里的substr就能做了。

 1 //#include<bits/stdc++>
 2 #include<stdio.h>
 3 #include<iostream>
 4 #include<algorithm>
 5 #include<cstring>
 6 #include<stdlib.h>
 7 #include<queue>
 8
 9 #define LL long long
10 #define ull unsigned long long
11 #define inf 0x3f3f3f3f
12
13 using namespace std;
14
15 string all = "", tmp;
16
17 int main()
18 {
19     while(cin>>tmp){
20         all += ‘$‘;
21         all += tmp;
22     }
23     int len = all.length();
24     for(int i = 0; i < len; i++){
25         if(all[i] >= ‘A‘ && all[i] <= ‘Z‘){
26             all[i] = all[i] - ‘A‘ + ‘a‘;
27         }
28     }
29     //cout<<len<<endl;
30     //cout<<all<<endl;
31
32     int cnt = 0;
33     for(int i = 0; i <= len - 4; i++){
34         if(all.substr(i, 4) == "doge"){
35             cnt++;
36             //cout<<i<<endl;
37         }
38     }
39     printf("%d\n", cnt);
40 }

原文地址:https://www.cnblogs.com/wyboooo/p/10260833.html

时间: 2024-11-08 15:14:38

hdu4847 Wow!Such Doge!【字符串】【暴力】的相关文章

hdu4847:Wow! Such Doge!(字符串匹配)

题目:hdu4847:Wow! Such Doge! 题目大意:在给出的段落里面找出"doge"出现的次数,大小写都可以. 解题思路:字符串匹配问题,可以在之前将字母都转换成统一格式. 代码: #include <stdio.h> #include <string.h> const int N = 1e6; char str[N]; const char *s1 = "doge"; int find () { int sum = 0; cha

hdu4847 Wow! Such Doge!(此题简单+坑爹的输入)

转载请注明出处:http://blog.csdn.net/u012860063?viewmode=contents 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4847 Problem Description Chen, Adrian (November 7, 2013). "Doge Is An Ac- tually Good Internet Meme. Wow.". Gawker. Retrieved November 22, 2

hdu4847 Wow! Such Doge!(简单题+坑爹的输入)

转载请注明出处:http://blog.csdn.net/u012860063?viewmode=contents 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4847 --------------------------------------------------------------------------------------------------------------------------------------------

(KMP 水)Wow! Such Doge! -- hdu -- 4847

http://acm.hdu.edu.cn/showproblem.php?pid=4847 Wow! Such Doge! Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4847 Description Chen, Adrian (November 7, 2013). “Doge Is An Ac- tually Good Inter

(KMP 水)Wow! Such Doge! -- hdu

http://acm.hdu.edu.cn/showproblem.php?pid=4847 Wow! Such Doge! Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4847 Description Chen, Adrian (November 7, 2013). “Doge Is An Ac- tually Good Inter

HDU 4847 Wow! Such Doge! (注意输入格式!)

Wow! Such Doge! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1628    Accepted Submission(s): 1014 Problem Description Chen, Adrian (November 7, 2013). "Doge Is An Ac- tually Good Internet Me

Wow! Such Doge!---hdu4847(字符串水题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4847 题意就是求给出的文章中共有多少个doge,不区分大小写直接用strstr做就可以了: #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; const int N = 1100; int main() { int ans=0; char s[N]; while(get

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

Problem Description Chen, Adrian (November 7, 2013). "Doge Is An Ac- tually Good Internet Meme. Wow.". Gawker. Retrieved November 22, 2013. Doge is an Internet meme that became popular in 2013. The meme typically con- sists of a picture of a Shi

[日常] 算法-旋转字符串-暴力移位法

题目描述 给定一个字符串,要求把字符串前面的若干个字符移动到字符串的尾部,如把字符串"abcdef"前面的2个字符'a'和'b'移动到字符串的尾部,使得原字符串变成字符串"cdefab".请写一个函数完成此功能,要求对长度为n的字符串操作的时间复杂度为 O(n),空间复杂度为 O(1). 分析与解法 解法一:暴力移位法 初看此题,可能最先想到的方法是按照题目所要求的,把需要移动的字符一个一个地移动到字符串的尾部,如此我们可以实现一个函数LeftShiftOne(ch