简单模拟。依照题意处理一下字符串就可以。

应该是写题号写错了,本来我在VirtualJudge是加入的POJ 并查集与生成树的题。

#include<cstdio>
#include<cstring>
#include<string>
#include<queue>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<iostream>
#include<list>
#include<set>
#include<cmath>
#define INF 0x7fffffff
#define eps 1e-6
using namespace std;
void Mr_j(char *str)
{
int len=strlen(str);
char tmp=str[len-1];
for(int i=len-1;i>=0;i--)
str[i]=str[i-1];
str[0]=tmp;
}
void Mr_c(char *str)
{
int i;
char tmp=str[0];
for(i=0;i<strlen(str)-1;i++)
str[i]=str[i+1];
str[i]=tmp;
}
void Mr_e(char *str)
{
int len=strlen(str);
int i,j;
char tmp[1001];
for(i=0;i<len/2;i++)
tmp[i]=str[i];
if(len&1)i++;
for(j=0;i<len;i++,j++)
str[j]=str[i],str[i]=tmp[j];
}
void Mr_a(char *str)
{
int len=strlen(str);
for(int i=0;i<len/2;i++)
swap(str[i],str[len-i-1]);
}
void Mr_p(char *str)
{
for(int i=0;i<strlen(str);i++)
{
if(str[i]>'0'&&str[i]<='9')str[i]--;
else if(str[i]=='0')str[i]='9';
}
}
void Mr_m(char *str)
{
for(int i=0;i<strlen(str);i++)
{
if(str[i]>='0'&&str[i]<'9')str[i]++;
else if(str[i]=='9')str[i]='0';
}
}
int main()
{
char str[1001];
char order[1001];
int m;
scanf("%d",&m);
while(m--)
{
scanf("%s%s",order,str);
for(int i=strlen(order)-1;i>=0;i--)
{
if(order[i]=='J')Mr_j(str);
else if(order[i]=='C')Mr_c(str);
else if(order[i]=='E')Mr_e(str);
else if(order[i]=='A')Mr_a(str);
else if(order[i]=='P')Mr_p(str);
else if(order[i]=='M')Mr_m(str);
}
puts(str);
}
}

POJ 2041 Unreliable Message的更多相关文章

  1. poj 2041 Unreliable Message 字符串处理

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

  2. POJ 2041

    #include <iostream> #include <string> #include <algorithm> using namespace std; st ...

  3. HOJ题目分类

    各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...

  4. nordic-mesh中应用的代码实现

    nordic-mesh中应用的代码实现 Nordic-Mesh遵循SIG-Mesh-Profile中的mesh定义,实现了element.model等概念. 一个应用中包含一个或多个element,e ...

  5. mysql: Error Codes and Messages

    Appendix B. Error Codes and MessagesTable of Contents B.1. Server Error Codes and MessagesB.2. Clien ...

  6. MYSQL之错误代码----mysql错误代码与JAVA实现

    原文地址:MYSQL之错误代码----mysql错误代码与JAVA实现作者:戒定慧 his chapter lists the errors that may appear when you call ...

  7. Eclipse 4.2 failed to start after TEE is installed

    ---------------  VM Arguments---------------  jvm_args: -Dosgi.requiredJavaVersion=1.6 -Dhelp.lucene ...

  8. POJ 2774 Long Long Message 后缀数组

    Long Long Message   Description The little cat is majoring in physics in the capital of Byterland. A ...

  9. poj 2774 Long Long Message 后缀数组基础题

    Time Limit: 4000MS   Memory Limit: 131072K Total Submissions: 24756   Accepted: 10130 Case Time Limi ...

随机推荐

  1. listView中adapter有不同的click事件的简单写法

    在android中,listview一般都是通过一个adapter来绑定数据,一般的item的点击事件都会指向同一个目标(intent),仅仅是所带的參数不同而已.但有的时候事与愿违,每一个item的 ...

  2. [CortexM0--stm32f0308]Low Power Mode

    问题描写叙述 stm32f0308正常是运行在Run mode下.这样的mode是在reset之后的默认模式.Low Power Mode.即低功耗模式.用于在IC空暇时能够考虑选择进入.使系统耗能减 ...

  3. 探索Android调用系统的分享功能

    非常多的应用为了应用的推广和传播都会使用"分享"的功能,点击分享button.就能将想要分享的内容或者图片分享至QQ空间.微博.微信朋友圈等实现了分享功能的应用.这篇文章主要是为了 ...

  4. 怎样避免使用Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK之后的黑屏问题

    在自己的项目中.我须要使用Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK来開始新的activity同一时候移除之前全部的 ...

  5. C# 用ManulResetEvent 控制Thread的 Suspend、Resume

    class Program { static void Main(string[] args) { Thread thread = new Thread(Work); thread.Start(); ...

  6. BZOJ 1790: [Ahoi2008]Rectangle 矩形藏宝地

    BZOJ 1790: [Ahoi2008]Rectangle 矩形藏宝地 题目传送门 [题目大意] 游戏的主办方把这块开阔地当作第一象限,将所有可能埋藏宝藏的地方划成一个个矩形的土地,并把这些矩形土地 ...

  7. 杂项-建模:BIM

    ylbtech-杂项-建模:BIM 建筑信息模型是建筑学.工程学及土木工程的新工具.建筑信息模型或建筑资讯模型一词由Autodesk所创的.它是来形容那些以三维图形为主.物件导向.建筑学有关的电脑辅助 ...

  8. FLAG_DISMISS_KEYGUARD & FLAG_SHOW_WHEN_LOCKED

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD): 这一个标志的意思是去掉锁屏界面,但这对安全锁(图案或者密 ...

  9. node-express项目的搭建并通过mongoose操作MongoDB实现增删改查分页排序(四)

    最近写了一个用node来操作MongoDB完成增.删.改.查.排序.分页功能的示例,并且已经放在了服务器上地址:http://39.105.32.180:3333. Mongoose是在node.js ...

  10. windows服务更改配置文件

    现场部署的服务所在文件夹内容如上图所示,由于现场数据库服务器更改了IP,所以我服务里的数据库连接字符串也需要修改(注意到日志文件,从某天改了IP后就再也连不上数据库了) 修改过程: 1.打开服务管理, ...