#include <iostream>
#include <string>
#include <algorithm>
using namespace std; string fun_c(string s);
string fun_j(string s);
string fun_e(string s);
string fun_a(string s);
string fun_p(string s);
string fun_m(string s); int main()
{
//freopen("acm.acm","r",stdin);
int n;
string op;
string s;
int i;
cin>>n;
while(n --)
{
cin>>op;
cin>>s;
//cout<<op<<endl;
for(i = op.length()-; i >= ; -- i)
{
if(op[i] == 'A')
{
s = fun_a(s);
}
else if(op[i] == 'C')
{
s = fun_c(s);
}
else if(op[i] == 'J')
{
s = fun_j(s);
}
else if(op[i] == 'M')
{
s = fun_m(s);
}
else if(op[i] == 'P')
{
s = fun_p(s);
}
else if(op[i] == 'E')
{
s = fun_e(s);
} }
cout<<s<<endl;
}
} string fun_j(string s)
{
char tem;
int i;
// cout<<" 000000 "<<s.length()<<endl;
tem = s[s.length()-];
for(i = s.length()-; i > ; -- i)
{
s[i] = s[i-];
}
s[] = tem;
return s;
} string fun_c(string s)
{
int i;
char tem;
tem = s[];
for(i = ; i < s.length()-; ++ i)
{
s[i] = s[i+];
}
s[s.length()-] = tem;
return s;
} string fun_e(string s)
{
// cout<<"s :"<<s<<endl;
int len_half;
len_half = s.length()/;
string s_pre;
string s_bac;
int len_half_1;
int i;
// cout<<s.length()<<endl;
// cout<<"len "<<endl;
for(i = ; i < len_half; ++ i)
{
s_pre += s[i];
}
len_half_1 = s.length()-len_half;
for(i = len_half_1; i < s.length(); ++ i)
{
s_bac += s[i];
} for(i = ; i < len_half; ++ i)
{
s[i] = s_bac[i];
}
// cout<<len_half<<endl;
// cout<<len_half_1<<endl;
// cout<<")))))))))))))))"<<endl;
int j = ;
for(i = len_half_1; i < s.length(); ++ i)
{
s[i] = s_pre[j ++];
} // cout<<"p :"<<s_pre<<endl;
// cout<<"b :"<<s_bac<<endl;
return s;
} string fun_a(string s)
{
reverse(s.begin(),s.end());
return s;
} string fun_p(string s)
{
int i;
for(i = ; i < s.length(); ++ i)
{
if(s[i] >= '' && s[i] <= '')
{
s[i] = char(s[i]-);
}
else if(s[i] == '')
{
s[i] = '';
}
}
return s;
} string fun_m(string s)
{
int i;
for(i = ; i < s.length(); ++ i)
{
if(s[i] >= '' && s[i] <= '')
{
s[i] = char(s[i]+);
}
else if(s[i] == '')
{
s[i] = '';
}
}
return s;
}

关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。

技术网站地址: vmfor.com

POJ 2041的更多相关文章

  1. poj 2041 Unreliable Message 字符串处理

    水的问题.直接附着到代码. //poj 2041 //sep9 #include <iostream> using namespace std; char mode[128]; char ...

  2. POJ 2041 Unreliable Message

    简单模拟.依照题意处理一下字符串就可以. 应该是写题号写错了,本来我在VirtualJudge是加入的POJ 并查集与生成树的题. #include<cstdio> #include< ...

  3. poj 题目分类(1)

    poj 题目分类 按照ac的代码长度分类(主要参考最短代码和自己写的代码) 短代码:0.01K--0.50K:中短代码:0.51K--1.00K:中等代码量:1.01K--2.00K:长代码:2.01 ...

  4. POJ题目分类(按初级\中级\高级等分类,有助于大家根据个人情况学习)

    本文来自:http://www.cppblog.com/snowshine09/archive/2011/08/02/152272.spx 多版本的POJ分类 流传最广的一种分类: 初期: 一.基本算 ...

  5. OpenJudge / Poj 1044 Date bugs C++

    链接地址: Poj:http://poj.org/problem?id=1044 OpenJudge:http://bailian.openjudge.cn/practice/1044/ 题目: 总时 ...

  6. POJ题目细究

    acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  102 ...

  7. 转载:poj题目分类(侵删)

    转载:from: POJ:http://blog.csdn.net/qq_28236309/article/details/47818407 按照ac的代码长度分类(主要参考最短代码和自己写的代码)  ...

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

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

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

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

随机推荐

  1. 在Linux下JDK1.4.2安装报错的解决方法

    JDK1.4.2的安装   Do you agree to the above license terms? [yes or no]   yes   Unpacking...   tail: cann ...

  2. Oracle redo 日志切换时间频率

    DB: 11.2.0.3.0 查看Oracle的redo日志切换频率 两条SQL,原理是一样的,第二个用到了统计函数 时间单位:分钟 方法一. select * from v$log a where ...

  3. [INS-41112] Specified network interface doesnt maintain connectivi

    OS: Oracle Linux Server release 6.3 DB: Oracle 11.2.0.3 安装11.2.0.3.0的RAC,在安装GRID时报错: [INS-41112] Spe ...

  4. oracle 事务处理 注意事项(笔记)

    事务:一个独立的逻辑工作单元.它有特定的一系列必须作为一个整体一起成功或者失败的SQL语句组成.是一个要么全有要么全无,很个性的一个东东. 事务的四大属性——ACID属性:原子性(atomicity) ...

  5. Redis 四:存储类型之有序集合

    有序集合似乎更大的操作是由于加了一个叫做“分子”的东西 事实上就好像普通的数据,只是为这个数据加了一个纯数字的标识, 通过操作这些标识来得到我们想要的数据! 分子可以是整形,也可以是双精度浮点型: = ...

  6. android开发系列之消息机制

    最近接触到一个比较有挑战性的项目,我发现里面使用大量的消息机制,现在这篇博客我想具体分析一下:android里面的消息到底是什么东西,消息机制到底有什么好处呢? 其实说到android消息机制,我们可 ...

  7. android bluetooth UUID蓝牙查询表

    ServiceDiscoveryServerServiceClassID_UUID = '{00001000-0000-1000-8000-00805F9B34FB}' BrowseGroupDesc ...

  8. WPF窗口长时间无人操作鼠标自动隐藏

    在软件开发中有时会有等待一段时间无人操作后隐藏鼠标,可能原因大致如下: 1.为了安全性,特别是那些需要用到用户名和密码登录服务端的程序,常常考虑长期无人操作,程序自动跳转到用户登录界面: 2.软件为了 ...

  9. C#判断字符串为空

    string str = null; if (string.IsNullOrWhiteSpace(str)) { MessageBox.Show("字符串为null"); } if ...

  10. Teamwork——Week4 团队分工和预估项目时间

    由于我们给每个组员预估的每天用在该团队项目的时间为2h左右,因此我们的时间计算也已2h为基数.下面就是我们的团队分工和预估项目时间. 任务编号 实现人员 任务详细描述 预估时间 任务0 全体组员 看学 ...