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

应该是写题号写错了,本来我在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. [HTML5] Handle Offscreen Accessibility

    Sometime when some component is offscreen, but still get focus when we tab though the page. This can ...

  2. MMORPG大型游戏设计与开发(server 游戏场景 事件)

    游戏截图 场景事件 一个完整的对象一般都拥有事件,至于什么是事件在这里就不多解释了. 在场景中的事件在天龙/武侠世界中的事件包含场景初始化.场景定时器.场景退出.玩家进入场景.角色升级.角色死亡.角色 ...

  3. Ubuntu14.04编译WebRTC For Android代码 2014-07-24

    整整快一年没有写博客了.近期基于Google开源的WebRTC项目做了一款音视频聊天的即时通信项目,期间在下载WebRTC代码时就碰到了一些问题.在此以作记录,也希望可以帮助到正在下载编译WebRTC ...

  4. ftk学习记(首篇)

    [ 声明:版权全部,欢迎转载,请勿用于商业用途.  联系信箱:feixiaoxing @163.com] 非常早之前就知道ftk了,当时主要是由于买了李先静的书,所以知道了这么一个项目.由于对这样的g ...

  5. C# Keywords - as

    记录一下在日常开发过程中遇到的一些C# 基础编程的知识! 希望以后能用的着.知识是在平常的开发过程中去学到的.只有用到了,你才能深入的理解它,并用好它. 本资料来源于:MSND 下面是一些相关的cod ...

  6. JVM源码分析之javaagent原理完全解读--转

    原文地址:http://www.infoq.com/cn/articles/javaagent-illustrated 概述 本文重点讲述javaagent的具体实现,因为它面向的是我们Java程序员 ...

  7. Android Handler学习笔记

    已经习惯了挖坑不填,继续任性一下,周一到周五继续挖坑,每周六周日负责填坑. 1.从Android UI线程谈起 出于性能考虑,Android 中的UI操作并不是线程安全的,所以Android中规定只能 ...

  8. SQL学习——基础语句(4)

    前面感觉真的好乱,想哪,写哪.这里慢慢整理…… SQL Having 语句 还是前面的那两个表: grade表: student表: 我们需要查找这里的s_id下的gradeValue的和,这就要分组 ...

  9. Android设计模式—— 观察者模式(以及EventBus的简单使用)

    1.概述 观察者模式最常用的地方是GUI系统.订阅-发布系统.观察者模式的一个重要作用就是解耦,将观察者和被观察者解耦,使得他们之间的依赖性更小. 2.定义 定义对象间的一种一对多依赖关系,使得每当一 ...

  10. RabbitMQ基础学习笔记(C#代码示例)

    一.定义: MQ是MessageQueue,消息队列的简称(是流行的开源消息队列系统,利用erlang语言开发).MQ是一种应用程序对应用程序的通信方法.应用程序通过读写入队和出队的消息来通信,无需专 ...