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

应该是写题号写错了,本来我在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. [HTML 5] Styling with ARIA

    See if you can do a better job styling this button using ARIA states. One huge benefit to styling wi ...

  2. 《生活在Linux中》之:在Bash的Emacs模式中使用Vim

    export EDITOR=vim ctrl-x ctrl-e

  3. USACO 1.2 Transformations (模拟)

    模拟题目,依照题目给定的要求变换图形就可以,变换的优先级依次减小. 这个题目我写的非常乱.只是最还还是勉强能够执行 /* ID:twd30651 PROG:transform LANG:C++ */ ...

  4. 常用的Linux 命令

    来源于面试 求一条linux命令:查找当前目录下所有含有字符串type="json",文件名以.xml的所有文件 find . -name "*.xml"|xa ...

  5. 使用从mysql中取数据

    import MySQLdb conn=MySQLdb.connect(host="xx",user="xx",passwd="xx",db ...

  6. 【1】按照Django官网,编写一个web app 创建project/配置数据库

    1. Creating a project From the command line, cd into a directory where you'd like to store your code ...

  7. Java类的根Object

    一.Object类介绍 Object全名java.lang.Object,java.lang包在使用的时候无需显示导入,编译时由编译器自动导入.Object类是类层次结构的根,Java中所有的类从根本 ...

  8. Android WebView访问网站携带登录认证Cookies和动态自定义的cookies

    最近项目几个页面要复用微信程序的网页.但是需要调用微网站登录接口,返回Cookies,webview访问需要的网页的时候携带. 并且还需要几个其他的动态改变的cookie,目的是根据这几个动态自定义c ...

  9. Android跳转到系统Wifi界面的方式

    第一种 Intent intent = new Intent(); intent.setAction("android.net.wifi.PICK_WIFI_NETWORK"); ...

  10. pixhawk入门知识

    Pixhawk是一种先进的自动驾驶仪,由PX4开放硬件项目设计和3D机器人制造.它具有来自ST公司先进的处理器和传感器技术,以及NuttX实时操作系统,能够实现惊人的性能,灵活性和可靠性控制任何自主飞 ...