codeforces Strings of Power
来源:互联网 发布:淘宝宝贝怎么发布 编辑:程序博客网 时间:2024/05/18 03:50
题目链接:http://codeforces.com/problemset/problem/318/B
题目大意:字符串匹配问题。找heavy和metal搭配的总数。
#include<iostream>#include<cstring>#include<string>using namespace std;int main(void){ string str; int i; cin>>str; long long sum1=0, sum2=0; for(i=0; i<str.size(); ++i) { if("heavy"==str.substr(i, 5)) ++sum1; else if("metal"==str.substr(i, 5)) sum2+=sum1; } cout<<sum2<<endl; return 0;}
0 0
- codeforces Strings of Power
- Codeforces Round #188 (Div. 2) B. Strings of Power
- B. Strings of Power
- Strings of Power
- [选拔赛]Strings of Power
- Strings of Power
- Strings of Power
- B. Strings of Power
- Strings of Power
- Strings of Power
- cf 318B. Strings of Power
- Power Strings
- Power Strings
- Power Strings
- Power Strings
- Power Strings
- Power Strings
- Power Strings
- php 简单生成 excel文件
- HDOJ 2196 Computer
- Android多线程方式处理图片下载及显示
- mac下安装wordpress以及配置相关环境
- 一种中文文本的快速分词方法(二)
- codeforces Strings of Power
- ZOJ 3201 Tree of Tree
- Struts2模型驱动
- Computer Science Study Summary --part 3
- A+B Problem(V)
- dp 01串
- Android 发送HTTP GET POST 请求以及通过 MultipartEntityBuilder 上传文件
- 一种中文文本的快速分词方法(三)
- Android编译笔记