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个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...
随机推荐
- java简单的文件读写工具类
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedRead ...
- 中间件RabbitMQ之运维篇
一.RabbtMQ简介 RabbitMQ的官方站: http:/://www.rabbitmq.com/ rabbitMQ是一个在AMQP协议标准基础上完整的,可服用的企业 ...
- 安装Python-Jenkins
有两种方式安装: ①有网络:sudo pip install python-jenkins ②无网络: 下载文件:https://pypi.org/project/python-jenkins/#fi ...
- http://ctf.bugku.com/challenges#love:bugku--love
做了一道逆向题目,主要关联到base64编码的知识点.下面做一分析. 题目如下: 通过测试,可知它没有加壳.尝试使用IDA进行分析. 1.IDA分析文件 打开文件后,按[shift+F12 ...
- Spring Boot+Quartz实现一个实时管理的定时任务
转载 https://www.cnblogs.com/wujiwen/p/9615120.html 项目实践过程中碰到一个动态管理定时任务的需求:针对每个人员进行信息的定时更新,具体更新时间可随时调整 ...
- kalman滤波(二)---扩展kalman滤波[EKF]的推导
一.状态估计的解释 我们知道每个方程都受噪声的影响,这里把位姿x和路标y看成服从某种概率分布的随机变量.因此我们关心的问题就变成了:当我们已知某些运动数据u和观测数据z时,如何确定状态量x,y的分布? ...
- php Pthread 多线程 Worker
<?php //PHP 高级编程之多线程 http://www.netkiller.cn/journal/thread.php.html#idp57489856 //worker 是一个具有持久 ...
- django 在centos 7 下 指定ip地址和端口 报错问题
windows environment: python manage.py runserver host:port centos environment: python manage.py runse ...
- 关于双重for循环封装数据问题
1.问题描述 在使用双重for循环进行封装数据时出现一个问题,就是有的数据封装上了,有的数据未封装上,找了很久原因: for (A a:ListA) { for (B b: ListB) { if(a ...
- Subarray Sums Divisible by K LT974
Given an array A of integers, return the number of (contiguous, non-empty) subarrays that have a sum ...