cf Strings of Power
http://codeforces.com/contest/318/problem/B
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std; char str[]; int main()
{
cin>>str;
int k=strlen(str);
__int64 t=,ans=;
for(int i=; i<k; i++)
{
if(str[i]=='h'&&str[i+]=='e'&&str[i+]=='a'&&str[i+]=='v'&&str[i+]=='y'&&i+<k)
{
t++;
}
if(str[i]=='m'&&str[i+]=='e'&&str[i+]=='t'&&str[i+]=='a'&&str[i+]=='l'&&i+<k)
{
ans+=t;
}
}
cout<<ans<<endl;
return ;
}
cf Strings of Power的更多相关文章
- Codeforces Round #188 (Div. 2) B. Strings of Power 水题
B. Strings of Power Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/318/p ...
- Strings of Power
B. Strings of Power Volodya likes listening to heavy metal and (occasionally) reading. No wonder Vol ...
- XSS attack
<html> <form action="" method="post"> <input type="text" ...
- Codeforces Round #188 (Div. 2) C. Perfect Pair 数学
B. Strings of Power Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/318/p ...
- Codeforces Round #188 (Div. 1 + Div. 2)
A. Even Odds 奇数个数\(\lfloor \frac{n+1}{2}\rfloor\) B. Strings of Power 从位置0开始,统计heavy个数,若当前为metal,则可以 ...
- POJ 2406 Power Strings (KMP)
Power Strings Time Limit: 3000MSMemory Limit: 65536K Total Submissions: 29663Accepted: 12387 Descrip ...
- POJ 2406 Power Strings
F - Power Strings Time Limit:3000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u S ...
- poj 2406:Power Strings(KMP算法,next[]数组的理解)
Power Strings Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 30069 Accepted: 12553 D ...
- POJ 2406:Power Strings
Power Strings Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 41252 Accepted: 17152 D ...
随机推荐
- Collections.shuffle源码阅读
java.util.Collections /** * Randomly permutes the specified list using a default source of * randomn ...
- B450配置
电脑型号 联想 B450 笔记本电脑 (扫描时间:2015?5?7?操作系统 Windows 7 旗舰版 32位 SP1 ( DirectX 11 ) 处理器 英特尔 酷睿2 双核 T9800 @ ...
- BZOJ3538: [Usaco2014 Open]Dueling GPS
3538: [Usaco2014 Open]Dueling GPS Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 59 Solved: 36[Subm ...
- Java中string拼接,StringBuilder,StringBuffer和+
Java中string拼接,StringBuilder,StringBuffer和+,到底哪个更合适? StringBuilder线程不安全,效率较线程安全的StringBuffer高.jdk1.5之 ...
- VS2010发布、打包安装程序
1. 在vs2010 选择“新建项目”→“ 其他项目类型”→“ Visual Studio Installer→“安装项目”: 命名为:Setup1 . 这是在VS2010中将有三个文件夹, 1.“应 ...
- linux应用程序地址布局
Linux应用程序在内存中的布局,由高地址到低地址依次为:栈.堆.BSS段.数据段.代码段.代码段的起始地址固定为0x8048000,无论哪一个应用程序它的代码段起始地址一定是0x8048000,这里 ...
- AngularJs中文社区学习资料
AngularJs中文社区学习资料,供学习: http://angularjs.cn/tag/AngularJS
- codevs1044:dilworth定理
http://www.cnblogs.com/submarine/archive/2011/08/03/2126423.html dilworth定理的介绍 题目大意:求一个序列的lds 同时找出这个 ...
- POJ 3009 深度优先搜索
问题:打冰球.冰球可以往上下左右4个方向走,只有当冰球撞到墙时才会停下来,而墙会消失.当冰球紧贴墙时,不能将冰球往那个方向打.冰球出界就当输,超过10次还没将冰球打到目标位置也当输.求用最小次数将冰球 ...
- DS18B20
DS18B20驱动 [ 2012-5-14 12:01:00 | By: 吴师傅 ] 14 推荐 一.概述 DS18B20是一种单总线数字温度传感器.測试温度范围-55℃-125℃,温度数据位可配 ...