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. druid + mysql + mybatis 批量更新报错

    首先 批量更新报错 sql injection violation, multi-statement not allow 然后看了博客:https://blog.csdn.net/qq_3634595 ...

  2. Django框架(九)-- 多表操作:一对一、一对多、多对多的增删改,基于对象/双下划线的跨表查询、聚合查询、分组查询、F查询与Q查询

    一.创建多表模型 一对一:OneToOneField 一对多:ForeignKey 多对多:ManyToManyField 创建表时,会自动添加一个nid字段,并且自增,所以id可以不用手动创建 On ...

  3. django2外键,F表达式,Q表达式

    一对多 环境 两个类:书的类别和文章,一片文章只能有一个作者,一个作者可以有多个文章,这之间组成了一对多的关系 class Category(models.Model): category = mod ...

  4. Apache Flink流式处理

    花了四小时,看完Flink的内容,基本了解了原理. 挖个坑,待总结后填一下. 2019-06-02 01:22:57等欧冠决赛中,填坑. 一.概述 storm最大的特点是快,它的实时性非常好(毫秒级延 ...

  5. system.exit(int status)中status值不同时的区别

    status为0时为正常退出程序,也就是结束当前正在运行中的java虚拟机. status为非0的其他整数(包括负数,一般是1或者-1),表示非正常退出当前程序. 可以明确的是,无论status是什么 ...

  6. locust手机号批量注册性能测试

    from locust import TaskSet,task,HttpLocust from common.redisCon import redis_clusters import queue c ...

  7. 第12节-BLE协议HCI层的数据格式

    学习资料: 1. 蓝牙协议core_v5.0.pdf <Vol 2: Core System Package [BR/EDR Controller volume]>的“Part E: Ho ...

  8. python 文本全选

    这个是一个控制框有效果 # encoding: utf-8 from Tkinter import * def printentry(event): print("click on" ...

  9. 可怕的Full GC (转自Hbase不睡觉书)

    PS:之前做项目的时候,需要做个复杂的查询,大量的查询总是导致hbase集群奔溃,最后定位到时full GC的原因. 以下转自<Hbase不睡觉书>-------------------- ...

  10. 阿里云centos 7上面安装mysql5.7的详细步骤!!!

    前言: 网上太多的linux 的安装mysql教程,很多教程不全或者因为环境不一致导致无法成功安装,以下是亲测的可行性的方法,请参考. 步骤: Centos7操作系统YUM库列表里默认不再提供MySQ ...