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

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

  1. White: Ke1,Qd1,Ra1,Rh1,Bc1,Bf1,Nb1,a2,c2,d2,f2,g2,h2,a3,e4
  2. 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. +---+---+---+---+---+---+---+---+

【题目来源】

CTU Open 2005

【题目大意】

这题和上一题是相关联的,上一题是给棋盘让你输出棋子的坐标,这题时给坐标让你输出棋盘。

【题目分析】

先将整个棋盘的初始状态打表存放起来,然后每次都初始化,输入坐标后更新数组的值,最后输出。

思路清晰就能1A。

  1. #include<cstdio>
  2. #include<cstring>
  3. char Map[][];
  4. char Graph[][]=
  5. {
  6. '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
  7. '|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|',
  8. '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
  9. '|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',
  10. '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
  11. '|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|',
  12. '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
  13. '|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',
  14. '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
  15. '|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|',
  16. '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
  17. '|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',
  18. '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
  19. '|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|',
  20. '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
  21. '|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',
  22. '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
  23. };
  24.  
  25. void make_table()
  26. {
  27. for(int i=;i<;i++)
  28. for(int j=;j<;j++)
  29. Map[i][j]=Graph[i][j];
  30. }
  31.  
  32. char w[];
  33. char b[];
  34.  
  35. void update1(char c,char x1,char y1)
  36. {
  37. int x=(-(y1-'')+)*-;
  38. int y=(x1-'a'+)*-;
  39. Map[x][y]=c;
  40. }
  41.  
  42. void update2(char c,char x1,char y1)
  43. {
  44. int x=(-(y1-'')+)*-;
  45. int y=(x1-'a'+)*-;
  46. Map[x][y]=c+;
  47. }
  48.  
  49. void update3(char x1,char y1)
  50. {
  51. int x=(-(y1-'')+)*-;
  52. int y=(x1-'a'+)*-;
  53. Map[x][y]='P';
  54. }
  55.  
  56. void update4(char x1,char y1)
  57. {
  58. int x=(-(y1-'')+)*-;
  59. int y=(x1-'a'+)*-;
  60. Map[x][y]='p';
  61. }
  62.  
  63. int main()
  64. {
  65. while(scanf("White: %s",w)!=EOF)
  66. {
  67. getchar();
  68. scanf("Black: %s",b);
  69. getchar();
  70. make_table();
  71. int len1=strlen(w);
  72. int len2=strlen(b);
  73. for(int i=;i<len1;)
  74. {
  75. if(w[i]>='A'&&w[i]<='Z')
  76. {
  77. update1(w[i],w[i+],w[i+]);
  78. i+=;
  79. }
  80. else if(w[i]>='a'&&w[i]<='z')
  81. {
  82. update3(w[i],w[i+]);
  83. i+=;
  84. }
  85. }
  86. for(int i=;i<len2;)
  87. {
  88. if(b[i]>='A'&&b[i]<='Z')
  89. {
  90. update2(b[i],b[i+],b[i+]);
  91. i+=;
  92. }
  93. else if(b[i]>='a'&&b[i]<='z')
  94. {
  95. update4(b[i],b[i+]);
  96. i+=;
  97. }
  98. }
  99. for(int i=;i<;i++)
  100. {
  101. for(int j=;j<;j++)
  102. printf("%c",Map[i][j]);
  103. puts("");
  104. }
  105. }
  106. return ;
  107. }

模拟 + 打表 --- Emag eht htiw Em Pleh的更多相关文章

  1. 模拟 POJ 2993 Emag eht htiw Em Pleh

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

  2. 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 ...

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

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

  4. 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: ...

  5. 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 ...

  6. Emag eht htiw Em Pleh(imitate)

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

  7. POJ2993——Emag eht htiw Em Pleh(字符串处理+排序)

    Emag eht htiw Em Pleh DescriptionThis problem is a reverse case of the problem 2996. You are given t ...

  8. 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 ...

  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. json方式的面向对象、拖拽

    //json方式的面向对象 var obj= { a:, b:, c:function(){ alert( } } obj.c();//12 //命名空间 var miaov={}; miaov.co ...

  2. 藏红花StigmaCroci西红花StigmaCroci番红花

    伊朗藏红花(StigmaCroci)是一种耐旱植物,适于生长在冬季最低气温不低于零下20度,夏季最高气温不高于零上35度且气候干燥的地区. 因其水土和气候条件的限制,除了伊朗能大量种植外,希腊.印度. ...

  3. 开机注册联通2G网络

    2/3G PLMN LIST 在MM_RATCM_PLMN_LIST_CNF或NWSEL_MM_PLMN_SEARCH_CNF消息中可以查看2,3G搜到的PLMN LIST 内容如下: RAT:Rad ...

  4. JAVA concurrent包下Semaphore、CountDownLatch等用法

    CountDownLatch 跟join的区别 CountDownLatch用处跟join很像,但是CountDownLatch更加灵活,如果子线程有多个阶段a.b.c; 那么我们可以实现在a阶段完成 ...

  5. Xcode添加库文件framework (转)

    首先需要了解一下iOS中静态库和动态库.framework的概念 静态库与动态库的区别 首先来看什么是库,库(Library)说白了就是一段编译好的二进制代码,加上头文件就可以供别人使用. 什么时候我 ...

  6. JS在HTML文档引入位置

    我们今天来聊一聊关于JavaScript文件的引入位置的问题:大家在平时的Web开发中有没有想过这样一个问题,那就是我应该在文档的头部(也就是<head>标签内部里面)引入所需要的Java ...

  7. centos7删除PHP怎么操作

    前面我们说了centos7删除MariaDB,现在我们说说centos7删除PHP怎么操作?当然不是特殊需要,不要去删除PHP,后果很严重.操作之前请做好所有的备份!首先查看有没安装php以及版本 # ...

  8. 01-C#笔记-hello_world

    /* * 主文件是 xxx.cs * 基本的 hello world 程序如下: */ using System; using System.Collections.Generic; using Sy ...

  9. Layui 模板引擎中用了CheckBox,显示时没有样式

    渲染完成后,需要重新调用layui的方法. layui.form.render();

  10. python paramiko与linux的连接

    两种使用paramiko连接到linux服务器的代码 方式一: 1 ssh = paramiko.SSHClient() 2 ssh.set_missing_host_key_policy(param ...