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

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

  1. #include<cstdio>
  2. #include<cstring>
  3. #include<string>
  4. #include<queue>
  5. #include<algorithm>
  6. #include<queue>
  7. #include<map>
  8. #include<stack>
  9. #include<iostream>
  10. #include<list>
  11. #include<set>
  12. #include<cmath>
  13. #define INF 0x7fffffff
  14. #define eps 1e-6
  15. using namespace std;
  16. void Mr_j(char *str)
  17. {
  18. int len=strlen(str);
  19. char tmp=str[len-1];
  20. for(int i=len-1;i>=0;i--)
  21. str[i]=str[i-1];
  22. str[0]=tmp;
  23. }
  24. void Mr_c(char *str)
  25. {
  26. int i;
  27. char tmp=str[0];
  28. for(i=0;i<strlen(str)-1;i++)
  29. str[i]=str[i+1];
  30. str[i]=tmp;
  31. }
  32. void Mr_e(char *str)
  33. {
  34. int len=strlen(str);
  35. int i,j;
  36. char tmp[1001];
  37. for(i=0;i<len/2;i++)
  38. tmp[i]=str[i];
  39. if(len&1)i++;
  40. for(j=0;i<len;i++,j++)
  41. str[j]=str[i],str[i]=tmp[j];
  42. }
  43. void Mr_a(char *str)
  44. {
  45. int len=strlen(str);
  46. for(int i=0;i<len/2;i++)
  47. swap(str[i],str[len-i-1]);
  48. }
  49. void Mr_p(char *str)
  50. {
  51. for(int i=0;i<strlen(str);i++)
  52. {
  53. if(str[i]>'0'&&str[i]<='9')str[i]--;
  54. else if(str[i]=='0')str[i]='9';
  55. }
  56. }
  57. void Mr_m(char *str)
  58. {
  59. for(int i=0;i<strlen(str);i++)
  60. {
  61. if(str[i]>='0'&&str[i]<'9')str[i]++;
  62. else if(str[i]=='9')str[i]='0';
  63. }
  64. }
  65. int main()
  66. {
  67. char str[1001];
  68. char order[1001];
  69. int m;
  70. scanf("%d",&m);
  71. while(m--)
  72. {
  73. scanf("%s%s",order,str);
  74. for(int i=strlen(order)-1;i>=0;i--)
  75. {
  76. if(order[i]=='J')Mr_j(str);
  77. else if(order[i]=='C')Mr_c(str);
  78. else if(order[i]=='E')Mr_e(str);
  79. else if(order[i]=='A')Mr_a(str);
  80. else if(order[i]=='P')Mr_p(str);
  81. else if(order[i]=='M')Mr_m(str);
  82. }
  83. puts(str);
  84. }
  85. }

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. 用友ERP T6技术解析(六) 库龄分析

    2.4 库存管理   2.4.1 库龄分析 介绍:库存账龄是在某时间节点,某种或某类存货的库存时间的加权平均值,跟库存周转率关系明显,库存周转率越高,库存账龄越低,可是二者又不是反比关系.不能简单把库 ...

  2. nyoj 119 士兵杀敌(三) 【线段树】【单点更新】

    题意:. .. 策略如题. 思路:我们先如果仅仅求某一区间的最大值.我们仅仅须要利用线段树的模板.仅仅须要初始化和询问的时候小小的改动一下.改成祖先结点储存的不再是子节点的和而是两个子节点之间的最大值 ...

  3. AlertDialog自己定义View的使用方法+怎样改变弹出框的大小

    android系统定义了弹出框,支持我们自己定义布局: public AlertDialog getEditCustomDialog() { LayoutInflater inflater = get ...

  4. Codeforces Round #316 (Div. 2)E. Pig and Palindromes DP

    E. Pig and Palindromes   Peppa the Pig was walking and walked into the forest. What a strange coinci ...

  5. MyEclipse2015安装SVN插件

    一.下载SVN插件subclipse 下载地址:http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240 在打开的网 ...

  6. 0x17 二叉堆

    优先队列太好用了手写啥呀 poj1456 经过贪心专题的洗礼以后这题根本就不叫题啊...按时间大到小排每次取最大就好 #include<cstdio> #include<iostre ...

  7. 【NOI 2002】 银河英雄传说

    [题目链接] https://www.luogu.org/problemnew/show/P1196 [算法] 并查集 [代码] #include<bits/stdc++.h> using ...

  8. js 智能识别收获地址

    项目地址https://github.com/wzc570738205/smart_parse 支持以下数据格式 马云,1351111111,北京市朝阳区姚家园3楼 马云1351111111北京市朝阳 ...

  9. sql server 启用数据库的 Service Broker

    使用SqlDependency时要开启Service Broker ,那么SqlDependency是什么 https://www.cnblogs.com/zhaoyihao/p/5663258.ht ...

  10. (转载)Android快速开发偷懒必备,一句话搞定所有ViewGroup的Adapter . 支持自定义ViewGroup

    [置顶] [Android]快速开发偷懒必备,一句话搞定所有ViewGroup的Adapter . 支持自定义ViewGroup 标签: androidAdapter快速开发0耦合 2016-12-1 ...