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

应该是写题号写错了,本来我在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. c# DataTable to Object Mapping

    public static class DataTableExtensions { public static IList<T> ToList<T>(this DataTabl ...

  2. 我的Android进阶之旅------&gt;android Button上面的英文字符串自己主动大写的问题解决

    今天碰到一个关于Button的问题:android Button上面的英文字符串会自己主动变成大写,执行的Android 5.1版本号,例如以下图所看到的: 图1:Button 图2:TextView ...

  3. c2

    #include <stdio.h> int main() { // 整型常量 ; // 实型常量(小数) // 单精度float / 双精度double // 注意: 默认情况下编写的小 ...

  4. 终端安全工具 gartner 排名

    Reviews for Endpoint Detection and Response Solutions What is Endpoint Detection and Response Soluti ...

  5. SPFA(Shortest Path Faster Algorithm)

    特别说明 本文转载自三金(frinemore)的博客: 点这 前言 1.关于SPFA,它没死. 2.接下来的所有代码,都是自己手写的(未检查正确性,补充的代码有检查过,是对的),有错误请帮忙指出. S ...

  6. 常用相关linux命令

    查看进程netstat -tnlp | egrep "(9097)" lsof -i:9097 ps -ef | grep kafka 观察句柄变化lsof -p $pid | w ...

  7. vue-cli安装步骤

    vue-cli脚手架模板是基于node下的npm来完成安装的所以首先需要安装node 条件:  node在4.以上,npm在3以上 安装 指令: 1.npm install -g vue-cli 在全 ...

  8. JS应用实例1:表格各行换色

    效果如下: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...

  9. VC工程里,如何编译汇编语言的文件

    最近老是有朋友问,VC工程里,如何编译汇编语言的文件,接下来就说一下步骤: 1.将汇编语言文件,加入到工程里: 2.在Solution Explorer窗口中右键单击Visual C++项目,选择Bu ...

  10. C#测量程序运行时间及cpu使用时间实例方法

    private void ShowRunTime() { TimeSpan ts1 = Process.GetCurrentProcess().TotalProcessorTime; Stopwatc ...