Emag eht htiw Em Pleh

Description
This problem is a reverse case of the problem 2996. You are given the output of the problem H and your task is to find the corresponding input.
Input
according to output of problem 2996.
Output
according to input of problem 2996.
Sample Input
White: Ke1,Qd1,Ra1,Rh1,Bc1,Bf1,Nb1,a2,c2,d2,f2,g2,h2,a3,e4
Black: Ke8,Qd8,Ra8,Rh8,Bc8,Ng8,Nc6,a7,b7,c7,d7,e7,f7,h7,h6
Sample Output

  1. +---+---+---+---+---+---+---+---+
  2. |.r.|:::|.b.|:q:|.k.|:::|.n.|:r:|
  3. +---+---+---+---+---+---+---+---+
  4. |:p:|.p.|:p:|.p.|:p:|.p.|:::|.p.|
  5. +---+---+---+---+---+---+---+---+
  6. |...|:::|.n.|:::|...|:::|...|:p:|
  7. +---+---+---+---+---+---+---+---+
  8. |:::|...|:::|...|:::|...|:::|...|
  9. +---+---+---+---+---+---+---+---+
  10. |...|:::|...|:::|.P.|:::|...|:::|
  11. +---+---+---+---+---+---+---+---+
  12. |:P:|...|:::|...|:::|...|:::|...|
  13. +---+---+---+---+---+---+---+---+
  14. |.P.|:::|.P.|:P:|...|:P:|.P.|:P:|
  15. +---+---+---+---+---+---+---+---+
  16. |:R:|.N.|:B:|.Q.|:K:|.B.|:::|.R.|
  17. +---+---+---+---+---+---+---+---+
    题目大意:POJ2996的反向。输入2996的输出,输出2996的输入。
    解题思路:
        1.定义结构体存每个格子的状态
        2.初始化结构体数组为“:::”||“...”    
        3.读取字符串,根据数据改变结构体的第二个变量
        4.格式输出
    Code
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4. struct Point
  5. {
  6. char a,b,c;
  7. } P[];
  8. void Init()
  9. {
  10. int ok=;
  11. for (int i=; i<=; i++)
  12. {
  13. if (ok) P[i].a=P[i].b=P[i].c=':';
  14. else P[i].a=P[i].b=P[i].c='.';
  15. if (i%) ok=!ok;
  16. }
  17. }
  18. int main()
  19. {
  20. char x,y;
  21. int i,j;
  22. string White,Black;
  23. string tmp="+---+---+---+---+---+---+---+---+";
  24. getline(cin,White);
  25. getline(cin,Black);
  26. Init();
  27. for (i=; i<=White.length()-; i++)
  28. {
  29. if (White[i]>='A'&&White[i]<='Z')
  30. {
  31. x=White[i+],y=White[i+];
  32. P[(x--)*+(y-'a'+)].b=White[i];
  33. }
  34. else if (White[i-]==',')
  35. {
  36. x=White[i+],y=White[i];
  37. P[(x--)*+(y-'a'+)].b='P';
  38. }
  39. }
  40. for (i=; i<=Black.length()-; i++)
  41. {
  42. if (Black[i]>='A'&&Black[i]<='Z')
  43. {
  44. x=Black[i+],y=Black[i+];
  45. P[(x--)*+(y-'a'+)].b=Black[i]+;
  46. }
  47. else if (Black[i-]==',')
  48. {
  49. x=Black[i+],y=Black[i];
  50. P[(x--)*+(y-'a'+)].b='p';
  51. }
  52. }
  53. cout<<tmp<<endl;
  54. for (i=; i>=; i--)
  55. {
  56. cout<<'|';
  57. for (j=; j<=; j++)
  58. cout<<P[(i-)*+j].a<<P[(i-)*+j].b<<P[(i-)*+j].c<<'|';
  59. cout<<endl;
  60. cout<<tmp<<endl;
  61. }
  62. return ;
  63. }

POJ2993——Emag eht htiw Em Pleh(字符串处理+排序)的更多相关文章

  1. 模拟 POJ 2993 Emag eht htiw Em Pleh

    题目地址:http://poj.org/problem?id=2993 /* 题意:与POJ2996完全相反 模拟题 + 字符串处理:无算法,读入两行字符串找出相应点用used标记,输出时标记过的输出 ...

  2. Emag eht htiw Em Pleh(imitate)

    Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2901   Accepted:  ...

  3. Emag eht htiw Em Pleh 分类: POJ 2015-06-29 18:54 10人阅读 评论(0) 收藏

    Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2937   Accepted: ...

  4. Poj 2993 Emag eht htiw Em Pleh

    1.Link: http://poj.org/problem?id=2993 2.Content: Emag eht htiw Em Pleh Time Limit: 1000MS   Memory ...

  5. Emag eht htiw Em Pleh

    Emag eht htiw Em Pleh This problem is a reverse case of the problem 2996. You are given the output o ...

  6. 快速切题 poj 2993 Emag eht htiw Em Pleh 模拟 难度:0

    Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2806   Accepted:  ...

  7. POJ 2993 Emag eht htiw Em Pleh【模拟画棋盘】

    链接: http://poj.org/problem?id=2993 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27454#probl ...

  8. 模拟 + 打表 --- Emag eht htiw Em Pleh

    Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2578   Accepted: ...

  9. POJ 2993:Emag eht htiw Em Pleh

    Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64 ...

随机推荐

  1. 翻转单词顺序VS左旋转字符串

    题目:输入一个英文句子,翻转句子中单词的顺序,但单词内字符的顺序不变.句子中单词以空格符隔开.为简单起见,标点符号和普通字母一样处理.例如输入“I am a student.”,则输出“student ...

  2. CSS的引入方式

    再用HTML编写的文本中,有是没能达到我们想要的效果,此时此刻我们可以用过引用CSS来控制!这不仅使得效果好而且代码层次清晰.CSS的引入方式可以分为四类: 1.链入外部样式表,就是把样式表保存为一个 ...

  3. preventDefault()、stopPropagation()、return false 之间的区别

    “return false”之所以被误用的如此厉害,是因为它看起来像是完成了我们交给它的工作,浏览器不会再将我们重定向到href中的链接,表单也不会被继续提交,但这么做到底有什么不对呢? 可能在你刚开 ...

  4. (转)[Erlang 0080] RabbitMQ :VHost,Exchanges, Queues,Bindings and Channels

    和RabbitMQ这个项目的缘分好奇怪,很长一段时间内是只关注源代码,真的是Erlang开源项目中的典范;现在要在项目中应用RabbitMQ,从新的视角切入,全新的感觉.仿佛旧情人换了新衣,虽是熟稔却 ...

  5. php5.3不支持 ereg、ereg_replace等函数问题,如提示:Deprecated: Function ereg() is deprecated

    在php5.3中,正则函数ereg_replace已经废弃,而dedecms还继续用.有两个方案可以解决以上问题: 1.把php版本换到v5.3下. 2.继续使用v5.3,修改php.ini文件 ;e ...

  6. hdu 4641 K-string SAM的O(n^2)算法 以及 SAM+并查集优化

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=4641 题意:有一个长度为n(n < 5e4)的字符串,Q(Q<=2e5)次操作:操作分为:在末 ...

  7. Linux下crontab详解

    1.crond介绍 crond是Linux下的任务调度命令,让系统定期执行指定程序.crond命令每分钟都会检查是否有要执行的工作,若有要执行的程序便会自动执行. linux下任务调度工作主要分两类: ...

  8. 【cheerio】nodejs的抓取页面模块

    http://baike.baidu.com/link?url=8V1CZsEzNE05ujOzISquom_pvFj16sWu1rRb8js11pmd9HNq7ePW_aKfG9oyXj6Txuu5 ...

  9. C# Windows - TabControl

    TabControl控件的属性 - 一般用于控制TabPages对象容器的外观,特别是显示的选项卡的外观 属性 说明 Alignment 控制选项卡在选项卡控件的什么位置显示 Appearance 控 ...

  10. 在PyCharm里配置SubVersion

    1.如果PyCharm不支持svn ,那么下载svn命令行安装包,下载地址:http://sourceforge.net/projects/win32svn/ 例如:安装到 D:\software\s ...