#include <iostream>
#include <string>
#define MAXN 27
using namespace std; short map[MAXN];
short cul[MAXN]; int main()
{
//freopen("acm.acm","r",stdin);
int test;
int time;
int wait;
string s;
map[] = ;
map[] = ;
map[] = ; map[] = ;
map[] = ;
map[] = ; map[] = ;
map[] = ;
map[] = ; map[] = ;
map[] = ;
map[] = ; map[] = ;
map[] = ;
map[] = ; map[] = ;
map[] = ;
map[] = ;
map[] = ; map[] = ;
map[] = ;
map[] = ; map[] = ;
map[] = ;
map[] = ;
map[] = ; // cul[0] = 1;
cul[] = ;
cul[] = ;
cul[] = ; cul[] = ;
cul[] = ;
cul[] = ; cul[] = ;
cul[] = ;
cul[] = ; cul[] = ;
cul[] = ;
cul[] = ; cul[] = ;
cul[] = ;
cul[] = ; cul[] = ;
cul[] = ;
cul[] = ;
cul[] = ; cul[] = ;
cul[] = ;
cul[] = ; cul[] = ;
cul[] = ;
cul[] = ;
cul[] = ;
cin>>test;
while(test --)
{
cin>>time>>wait;
getchar();
getline(cin,s);
// cout<<s<<endl;
int sum = ;
int i;
for(i = ; i < s.length(); ++ i)
{
if(s[i] == ' ')
{
sum += time;
}
else if(i != && map[s[i-] - 'A'] != ' ' && map[s[i]-'A'] == map[s[i-]-'A'])
{
sum += wait;
sum += cul[s[i]-'A'+]*time;
}
else
{
sum += cul[s[i]-'A'+]*time;
}
}
cout<<sum<<endl;
}
}

POJ 2895的更多相关文章

  1. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  2. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  3. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  4. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  5. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

  6. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

  7. POJ 2255. Tree Recovery

    Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11939   Accepted: 7493 De ...

  8. POJ 2752 Seek the Name, Seek the Fame [kmp]

    Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 17898   Ac ...

  9. poj 2352 Stars 数星星 详解

    题目: poj 2352 Stars 数星星 题意:已知n个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...

随机推荐

  1. xml文件中&符号需要转义为&amp;

    xml文件中&符号需要转义为&

  2. effector - 必应词典

    effector - 必应词典 美[ɪ'fektə(r)]英[ɪ'fektə(r)] n.效应物 网络效应器:效果器:受动器 变形复数:effectors:

  3. 2018 宁夏省赛 F. Moving On

    题目链接 https://nanti.jisuanke.com/t/28406 大意是 有n(<=200)个城市,城市间有路(Input给了邻接矩阵)  每个城市有一个危险值,然后是q(2e4) ...

  4. 【python原理解析】python中分片的实现原理及使用技巧

    首先:说明什么是序列? 序列中的每一个元素都会被分配一个序号,即元素的位置,也称为索引:在python中的序列包含:字符串.列表和元组 然后是:什么是分片? 分片就是通过操作索引访问及获得序列的一个或 ...

  5. Add custom field in Material Master

    1.Add fields in the Append Structure of table MARA. 2.Configure SPRO IMG -> Logistics General -&g ...

  6. java编译时出现——注:使用了未经检查或不安全的操作。注:有关详细信息,请使用 -Xlint:unchecked 重新编译

    网上说是泛型问题 private List<Product> products = new ArrayList<Product>(); 这种用法绝对没错!(因为是照着书写的)在 ...

  7. 【.Net】 大文件可使用的文本分组统计工具(附带源码,原创)

    本工具可实现的效果: 1.读取大文件(大于1GB) 2.根据分隔符分割后的列分组 3.速度快. 4.处理过程中,可以随时停止处理,操作不卡死. 5.有对当前内存的实时监测,避免过多占用内存,影响系统运 ...

  8. mysql开启调试日志general_log开启跟踪日志

    general_log = 1 general_log_file = /tmp/umail_mysql.log 有时候,不清楚程序执行了什么sql语句,但是又要排除错误,找不到原因的情况下, 可以在m ...

  9. Linux学习小记(1)

    学习Linux,进行阶段性总结,权当笔记方便日后翻阅和查看. 在此特别推荐peida的博客,他的有关Linux的理解个人感觉深入浅出,很适合入门的小白来理解和学习. 说一说针对IP的修改,ifconf ...

  10. 1.5eigen中高级初始化

    1.5 高级初始化 这一节讨论一些初始化矩阵的高级方法. 1.The comma initializer eigen提供一个简单设定所有矩阵系数.向量.数组系数的初始化语法,从左上角开始到右下角结束. ...