#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. ORA-01078、ORA-01565、ORA-17503、ORA-29701

    OS: Oracle Linux Server release 5.7 DB: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - ...

  2. Javascript中“==”与“===”的区别

    在Javascript中有"=="和"==="两种比较运行符,那么他们有什么区别呢? 一.对于string,number等基础类型,==和===是有区别的 1) ...

  3. Android之Activity的四种启动模式

    当应用运行起来后就会开启一条线程,线程中会运行一个任务栈,当Activity实例创建后就会放入任务栈中.Activity启动模式的设置在AndroidManifest.xml文件中,通过配置Activ ...

  4. 慎把“DataContext”静态化 或则单例

    之前在项目里由于把DataContext静态化,最后在测试阶段发现了很多奇怪的问题,后来经过同事的指点 然后上网搜了一翻终于发现 MSDN上说:   "请不要试图重用 DataContext ...

  5. c# 各种排序算法+找第二大的数+句子单词反转

    冒泡排序 // 冒泡排序 bubble sort public static int[] BubbleSort(int []array) { bool isContinue = true; ; i & ...

  6. Android -- TouchEvent的分发和截获方式

    Android系统中的每个ViewGroup的子类都具有下面三个和TouchEvent处理密切相关的方法: public boolean dispatchTouchEvent(MotionEvent ...

  7. “来用”alpha版使用说明书

    1引言 1 .1编写目的 针对我们发布的alpha版本做出安装和使用说明,使参与内测的人员及用户了解软件的使用方法和相关内容. 1 .2参考资料 <c#程序设计基础>,赵敏主编,2011, ...

  8. 项目结队开发---NABC分析(成员)

    一.简介 项目名称:校园导航 特点:手机app,简便易用,适合对铁大地形不了解.路痴者使用. 二.NABC分析 N(need):对于新生报到,学生家长参观校园等想要了解校园路线者,本app软件将带给你 ...

  9. Could not load file or assembly 'Microsoft.Office.Interop.Word, Version=14.0

    参考地址一:点击这里 参考地址二:点击这里 解决方法: 使用office COM元件,电脑里必须要有相对应的版本,比如 Excel 14.0是对应Excel 2010 Excel 12.0是对应Exc ...

  10. winform - BackgroundWorker

    http://www.cnblogs.com/happy555/archive/2007/11/07/952315.html 在VS2005中添加了BackgroundWorker组件,该组件在多线程 ...