POJ 2895
#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的更多相关文章
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
- POJ 2255. Tree Recovery
Tree Recovery Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11939 Accepted: 7493 De ...
- 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 ...
- poj 2352 Stars 数星星 详解
题目: poj 2352 Stars 数星星 题意:已知n个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...
随机推荐
- Python的基本用法
---恢复内容开始--- 一.函数 1.1 默认参数 想要计算一个数x的n次方,可以定义如下的函数.但是有时候我们仅仅只需要计算x^2,所以只想使用一个参数即power(x),这时如果仍用如下代码会报 ...
- ExecuteReader()获得数据
ExecuteReader用于实现只进只读的高效数据查询.ExecuteReader:返回一个SqlDataReader对象,可以通过这个对象来检查查询结果,它提供了只进只读的执行方式,即从结果中读取 ...
- 自定义RPC框架--基于JAVA实现
视频教程地址 DT课堂(原名颜群) 整体思路RPC(Remote Procedure Call),即远程过程调用.使用RPC,可以像使用本地的程序一样使用远程计算机上的程序.RPC使得开发分布式程序更 ...
- easyui Tree树形控件的异步加载
Tree控件 $('#partyOrgTree').tree({ checkbox: false, url: getDataUrl, onClick: function (node) { getDiv ...
- dtruss
一.简介 系统调用跟踪工具. 二.实例
- python历史与基本类型
前言 我自学的方式主要是看文档,看视频,第一次做写博客这么神圣的事情,内心是忐忑的,写的东西比较杂,路过的小伙伴不要嘲笑我,主要是记录一日所学,顺便锻炼一下语言组织能力吧,anyway,这些都不重要, ...
- Connection lost: The server closed the connection
想必很多初学者都会遇到这个问题 其实很简单.mysql有个机制,就是8小时无通信,myslq就会自动关闭数据; 解决方案(2选1): 或者: 1.定时去做一个查询,就是 select * from X ...
- Servlet执行流程和生命周期
Servlet执行流程 Get方式请求HelloServlet ---> <a href="servlet/HelloServlet"> ↓ 服务器在配置文档中查 ...
- mui几种页面跳转方式对比
1.初始化时创建子页面 mui.init({ subpages: [{ url: your - subpage - url, //子页面HTML地址,支持本地地址和网络地址 id: your - su ...
- Git+Github入门
1.安装Git git 返回上一级文件命令 cd ..(cd 和..之间有空格) 2.安装完成后需进一步设置,在命令行输入 3.选择一个合适的地方创建一个空目录 pwd命令用于显示当前目录 4.通过g ...