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个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...
随机推荐
- centos部署redis主从
安装环境 CentOS 6.5 .CentOS 7.4 主Redis:10.159.44.175 从Redis: 10.159.44.176.10.159.44.177 Redis下载和安装 在3台机 ...
- vue 根据接口返回的状态码判断用户登录状态并跳转登录页,登录后回到上一个页面(http拦截器)
背景:后台接口返回code==501表示用户是未登录状态,需要登录才可访问: 通过http拦截做路由跳转 第一步:src目录下新建http.js文件,内容如下: import Axios from ' ...
- [Bat]如何彻底关闭每个盘符默认的共享$(即使重启也有效)
Windows启动时都会默认打开admin$ ipc$ 和每个盘符的共享,对于不必要的默认共享,一般都会把它取消掉,可当又需要打开此默认共享时,又该从哪里设置呢,一般来说有两个地方,MSDOS命令和计 ...
- Python11/12--GIL/互斥锁/进程池
GIL1.全局解释器锁? 锁就是线程里面那个锁 锁是为了避免资源竞争造成数据的错乱 2.python程序的执行过程? 1.启动解释器进程 python.exe 2.解析你的py文件并执行它 每个py程 ...
- windows下多tomcat部署
两种方式: 第一种是修改tomcat下很多配置文件,且配置环境变量: 第二种不配tomcat环境变量,通过修改server.xml文件即可: 本篇讲解第二种方式: 首先说下如何修改tomcat控制台标 ...
- ABP框架系列之四十二:(Object-To-Object-Mapping-对象映射)
Introduction It's a common to map a similar object to another object. It's also tedious and repeatin ...
- ABP框架系列之二十七:(Feature-Management-特征管理)
Introduction Most SaaS (multi-tenant) applications have editions (packages) those have different fea ...
- 1018 Public Bike Management (30) Dijkstra算法 + DFS
题目及题解 https://blog.csdn.net/CV_Jason/article/details/81385228 迪杰斯特拉重新认识 两个核心的存储结构: int dis[n]: //记录每 ...
- & 引用
核心: 对引用的操作与对变量直接操作完全一样注意点: 引用并非是地址运算符 编译器一般将引用看作是const指针,即只占用指针大小空间 引用只能在初始化的时候引用一次 ,不能更改为转而引用其他变量.使 ...
- 【慕课网实战】Spark Streaming实时流处理项目实战笔记十九之铭文升级版
铭文一级:(没有内容) 铭文二级: 创建Spring boot项目: 看官网,Quick Start下面有两个依赖,必须得使用 但是如果用IDEA构建Spring boot,则会自动添加 New Pr ...