Codeforces Round #294 (Div. 2) D. A and B and Interesting Substrings
来源:互联网 发布:caffe识别验证码 编辑:程序博客网 时间:2024/06/04 00:47
http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=126640
1 2 3 4 5 6 7 8 9101112131415161718192021222324252627282930
#include <iostream>#include <cstdio>#include <cstring>#include <stdlib.h>#include <queue>#include <map>#define N 100001using namespace std;int a[30];char s[N];map<long long int ,int >q[30];int main(){ while(~scanf("%d",&a[0])) { for(int i=1; i<26; i++) scanf("%d",&a[i]); scanf("%s",s); long long int ans=0,sum=0; int len=strlen(s); for(int i=0; i<len; i++) { ans += q[s[i]-'a'][sum]; sum += a[s[i]-'a']; q[s[i]-'a'][sum]++; } printf("%I64d\n",ans); } return 0;}
0 0
- Codeforces Round #294 (Div. 2)D. A and B and Interesting Substrings
- hash(Codeforces Round #294 (Div. 2)D. A and B and Interesting Substrings)
- Codeforces Round #294 (Div. 2) -- D. A and B and Interesting Substrings
- Codeforces Round #294 (Div. 2) D. A and B and Interesting Substrings
- Codeforces Round #294 (Div. 2) D. A and B and Interesting Substrings(map)
- 【codeforces】Round #294 (Div. 2) D. A and B and Interesting Substrings
- Codeforces Round #294 (Div. 2) D. A and B and Interesting Substrings(前缀和+map)
- Codeforces Round #294 (Div. 2) D题:A and B and Interesting Substrings
- Codeforces Round #294 (Div. 2) D. A and B and Interesting Substrings
- Codeforces Round #294 (Div. 2)-D. A and B and Interesting Substrings
- Codeforces 519D - A and B and Interesting Substrings (思维)
- Codeforces 519D A and B and Interesting Substrings
- A and B and Interesting Substrings - CodeForces 519 D dp
- CodeForces 519D A and B and Interesting Substrings
- codeforces A and B and Interesting Substrings
- CF(#294 div2):D. A and B and Interesting Substrings
- #294 (div.2) D.A and B and Interesting Substring
- codeforces 519D D. A and B and Interesting Substrings(hash+dp)
- HDOJ Lotto (DFS)
- css编写超出元素宽度的中文显示省略号
- HDU 5347 MZL's chemistry
- c++实现链表的抽象数据结构
- POJ 3620 Avoid The Lakes(dfs)
- Codeforces Round #294 (Div. 2) D. A and B and Interesting Substrings
- HDU 5344
- 剑指Offer面试题24(Java版):二叉搜索树的后序遍历序列
- Android复习笔记(10) -对话框的使用
- HDU 5351 MZL's Border
- HDU 2546 饭卡
- 多线程1
- UVa 567 Risk (Floyd+任意两点最短路)
- C语言编程入门——综合练习(三)学生管理系统