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

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

+---+---+---+---+---+---+---+---+
|.r.|:::|.b.|:q:|.k.|:::|.n.|:r:|
+---+---+---+---+---+---+---+---+
|:p:|.p.|:p:|.p.|:p:|.p.|:::|.p.|
+---+---+---+---+---+---+---+---+
|...|:::|.n.|:::|...|:::|...|:p:|
+---+---+---+---+---+---+---+---+
|:::|...|:::|...|:::|...|:::|...|
+---+---+---+---+---+---+---+---+
|...|:::|...|:::|.P.|:::|...|:::|
+---+---+---+---+---+---+---+---+
|:P:|...|:::|...|:::|...|:::|...|
+---+---+---+---+---+---+---+---+
|.P.|:::|.P.|:P:|...|:P:|.P.|:P:|
+---+---+---+---+---+---+---+---+
|:R:|.N.|:B:|.Q.|:K:|.B.|:::|.R.|
+---+---+---+---+---+---+---+---+

【题目来源】

CTU Open 2005

【题目大意】

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

【题目分析】

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

思路清晰就能1A。

#include<cstdio>
#include<cstring>
char Map[][];
char Graph[][]=
{
'+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
'|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|',
'+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
'|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',
'+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
'|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|',
'+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
'|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',
'+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
'|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|',
'+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
'|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',
'+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
'|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|',
'+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
'|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',
'+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
}; void make_table()
{
for(int i=;i<;i++)
for(int j=;j<;j++)
Map[i][j]=Graph[i][j];
} char w[];
char b[]; void update1(char c,char x1,char y1)
{
int x=(-(y1-'')+)*-;
int y=(x1-'a'+)*-;
Map[x][y]=c;
} void update2(char c,char x1,char y1)
{
int x=(-(y1-'')+)*-;
int y=(x1-'a'+)*-;
Map[x][y]=c+;
} void update3(char x1,char y1)
{
int x=(-(y1-'')+)*-;
int y=(x1-'a'+)*-;
Map[x][y]='P';
} void update4(char x1,char y1)
{
int x=(-(y1-'')+)*-;
int y=(x1-'a'+)*-;
Map[x][y]='p';
} int main()
{
while(scanf("White: %s",w)!=EOF)
{
getchar();
scanf("Black: %s",b);
getchar();
make_table();
int len1=strlen(w);
int len2=strlen(b);
for(int i=;i<len1;)
{
if(w[i]>='A'&&w[i]<='Z')
{
update1(w[i],w[i+],w[i+]);
i+=;
}
else if(w[i]>='a'&&w[i]<='z')
{
update3(w[i],w[i+]);
i+=;
}
}
for(int i=;i<len2;)
{
if(b[i]>='A'&&b[i]<='Z')
{
update2(b[i],b[i+],b[i+]);
i+=;
}
else if(b[i]>='a'&&b[i]<='z')
{
update4(b[i],b[i+]);
i+=;
}
}
for(int i=;i<;i++)
{
for(int j=;j<;j++)
printf("%c",Map[i][j]);
puts("");
}
}
return ;
}

模拟 + 打表 --- 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. java hibnernet测试@test 时不提交保存的事务

    开始保存时不能提交数据报错: org.hibernate.HibernateException: Could not obtain transaction-synchronized Session f ...

  2. APP手势密码绕过

    之前写的文章收到了很多的好评,主要就是帮助到了大家学习到了新的思路.自从发布了第一篇文章,我就开始筹备第二篇文章了,最终打算在07v8首发,这篇文章我可以保障大家能够学习到很多思路.之前想准备例子视频 ...

  3. 藏红花StigmaCroci西红花StigmaCroci番红花

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

  4. 你家的APS系统有这些功能吗?排程系统功能盘点

    随着企业规模不断扩大,在经营管理方面会面临各种各样的问题,为了帮助解决此类问题,很多公司都会引入APS高级排程系统帮助进行生产管理的优化. APS系统针对的管理目标是 改善库存控制,大幅降低原料与中间 ...

  5. flink 实现ConnectedComponents 连通分量,增量迭代算法(Delta Iteration)实现详解

    1.连通分量是什么? 首先需要了解什么是连通图.无向连通图.极大连通子图等概念,这些概念都来自数据结构-图,这里简单介绍一下. 下图是连通图和非连通图,都是无向的,这里不扩展有向图: 连通分量(con ...

  6. Spring通过配置类加载实体bean

    以下4个java类都在都一个包下: 1.定义接口 public interface AA { void play(); } 2.定义实体bean //组件注解,表明该类是一个组件 @Component ...

  7. PHP使用PhpAnalysis进行分词

    1.介绍 PHPAnalysis分词程序使用居于unicode的词库,使用反向匹配模式分词,理论上兼容编码更广泛,并且对utf-8编码尤为方便. 下载地址:http://www.phpbone.com ...

  8. 【Spring Cloud】Spring Cloud之自定义@SpringCloudProfile注解实现@Profile注解的功能

    一.为什么会想到定义@SpringCloudProfile这样的注解 首页提一下@Profile注解:它主要用与Spring Boot多环境配置中,指定某个类只在指定环境中生效,比如swagger的配 ...

  9. dapi 基于Django的轻量级测试平台三 接口关联

    QQ群: GitHub:https://github.com/yjlch1016/dapi 一.接口关联思路: 在接口测试中, 很多场景下, 上一个接口的出参要作为下一个接口的入参, 即上一个接口的响 ...

  10. detectron2安装出现Kernel not compiled with GPU support 报错信息

    在安装使用detectron2的时候碰到Kernel not compiled with GPU support 问题,前后拖了好久都没解决,现总结一下以备以后查阅. 不想看心路历程的可以直接跳到最后 ...