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个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...
随机推荐
- elasticsearch数据结构
无论是关系型数据库还是非关系型数据库,乃至elasticsearch这种事实上承担着一定储存作用的搜索引擎,数据类型都是非常重要而基础的概念.本文基于elasticsearch 5.x版本. 核心数据 ...
- netty(一) netty有哪几部分构成
netty netty是一个支持高并发的非阻塞I/O框架. Channel Channel 是 NIO 基本的结构.它代表了一个用于连接到实体如硬件设备.文件.网络套接字或程序组件,能够执行一个或多个 ...
- CentOS7双网卡绑定配置
step1:创建绑定文件 [root@node-1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-bond0 TYPE="bond"BOO ...
- load 过高分析办法
1.top -H 找到占用cpu较高的进程2.top -Hp pid 找到该进程下占用cpu较高的线程id3.sudo -u adminjstack -F 进程id > ~/stack.txt ...
- Shell中read命令--学习
read命令 -p(提示语句) -n(字符个数) -t(等待时间) -s(不回显) 1.基本读取read命令接收标准输入(键盘)的输入,或其他文件描述符的输入(后面在说).得到输入后,read命令将数 ...
- [leetcode]84. Largest Rectangle in Histogram直方图中的最大矩形
Given n non-negative integers representing the histogram's bar height where the width of each bar is ...
- git 删除本地所有分支
除master的所有: git branch | grep -v "master" | xargs git branch -D Git删除分支的指令:git branch -d ...
- 异常解决 Unable to write generated Java files for schemas: null
错误是在使用cxf调用其他系统接口时报出的.而且问题很诡异,只有服务器调用时才报错,本地直接写main方法直接调用却正常的.以下是异常的堆栈: ERROR c.k.p.webservice.WebSe ...
- ImportError: No module named MySQLdb问题的解决
今天在windows上撸python代码,遇到ImportError: No module named MySQLdb的问题,遂赶紧pip install mysql-python,结果还是不行,查看 ...
- 探索未知种族之osg类生物---呼吸分解之更新循环三
补充 当然细心的你会发现,_scene->updateSceneGraph(*_updateVisitor)中还有一个imagePager::UpdateSceneGraph()还没有进行讲解, ...