链接:



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

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

Source


题意:

      画棋盘

      前面 ',' 前有三个字符的就画上第一个字符

      如果只有二个字符的就画上字符P

      如果是白色的位置的, 字符画大写

      如果是黑色的位置的, 字符画小写


注意:

输入的字符小写字母代表方格所在的的"行"('a'为第一行, 从下往上数)

数字代表方格的列, 
处理输入的字符前,要先初始化棋盘
 

坑:

      1,棋子数可能是能放满棋盘的任意多个。【我开始就是坑在了这里,问了下GJ才知道】

        2,可能先输入黑色,再输入白色

        3,P 不一定放在最后, 可能放在前面或中间

算法:


简单模拟



思路:

没什么思路,细心就好了=_=

/*****************************************************
Accepted 168 KB 0 ms C++ 2849 B
题意:画棋盘
前面 ',' 前有三个字符的就画上第一个字符
如果只有二个字符的就画上字符P
如果是白色的位置的, 字符画大写
如果是黑色的位置的, 字符画小写 注意:输入的字符小写字母代表方格所在的的"行"('a'为第一行, 从下往上数)
数字代表方格的列, 处理输入的字符前,要先初始化棋盘 坑:1,棋子数可能是能放满棋盘的任意多个。【我开始就是坑在了这里,问了下GJ才知道】
2,可能先输入黑色,再输入白色
3,P 不一定放在最后, 可能放在前面或中间 算法:简单模拟 思路:没什么思路,细心就好了=_=
******************************************************/
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std; char chess[20][40];
char s1[100];
char s2[100];
char s[100]; void solve(char s[], int flag) // 1= white, 0 = black
{
int x,y;
int len =strlen(s); //可能有任意多棋子,不能直接数
for(int i = 0; i < len;) //P (p) 可能输入在前面,不能分开计算
{
if(s[i] >= 'A' && s[i] <= 'Z')
{
x = 2*(s[i+2]-'0') - 1;
y = 4*(s[i+1]-'a'+1) - 2;
if(flag) chess[x][y] = s[i];
else chess[x][y] = s[i]+32;
i += 4;
}
else if(s[i] >= 'a' && s[i] <= 'z')
{
x = 2*(s[i+1]-'0') - 1;
y = 4*(s[i]-'a'+1) - 2;
if(flag) chess[x][y] = 'P';
else chess[x][y] = 'p';
i += 3;
}
}
} int main()
{
while(scanf("%s%s",s,s1) != EOF)
{
scanf("%s%s",s,s2); int flag1 = 1; //标记方格中两边的点
int flag2 = 1; // 标记方格中中间的点 for(int i = 0; i <= 16 ; i++) //初始化棋盘,如果看不懂,自己直接画一个赋值好了
{
if(i%2 == 0)//+ -
{
for(int j = 0; j <= 32; j++)
{
if(j%4 == 0) chess[i][j] = '+';
else chess[i][j] = '-';
}
} else if(i%2 == 1) // | :: ..
{
for(int j = 0; j <= 32; j += 4)
{
if(j%4 == 0)
{
chess[i][j] = '|'; //格子中两边的点
if(flag1 == 1)
{
chess[i][j+1] = ':';
chess[i][j+3] = ':';
}
else if(flag1 == 0)
{
chess[i][j+1] = '.';
chess[i][j+3] = '.';
}
flag1 = !flag1; //每行后面多填一个正好好标记下一行 //格子中中间的点
if(flag2 == 1)
{
chess[i][j+2] = ':';
}
else if(flag2 == 0)
{
chess[i][j+2] = '.';
}
flag2 = !flag2; //同上
}
}
}
} if(s[0] == 'W') //s2为白色,大写
{
solve(s1, 0);
solve(s2, 1);
}
else //s2为黑色,小写
{
solve(s1, 1);
solve(s2, 0);
} for(int i = 16; i >= 0; i--)
{
for(int j = 0; j <= 32; j++)
printf("%c", chess[i][j]);
printf("\n");
}
}
return 0;
}


POJ 2993 Emag eht htiw Em Pleh【模拟画棋盘】的更多相关文章

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

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

  2. 模拟 POJ 2993 Emag eht htiw Em Pleh

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

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

  4. poj 2993 Emag eht htiw Em Pleh(模拟)

    题目:http://poj.org/problem?id=2993 题意:和2996反着 #include <iostream> #include<cstdio> #inclu ...

  5. POJ 2993:Emag eht htiw Em Pleh

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

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

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

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

  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. Emag eht htiw Em Pleh(imitate)

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

随机推荐

  1. IP头,TCP头,UDP头,MAC帧头定义

    一.MAC帧头定义 /*数据帧定义,头14个字节,尾4个字节*/ typedef struct _MAC_FRAME_HEADER {  char m_cDstMacAddress[6];    // ...

  2. ES6里关于函数的拓展(一)

    一.形参默认值 Javascript函数有一个特别的地方,无论在函数定义中声明了多少形参,都可以传入任意数量的参数,也可以在定义函数时添加针对参数数量的处理逻辑,当已定义的形参无对应的传入参数时为其指 ...

  3. ElasticSearch 分布式集群

    1.前言 Elasticsearch用于构建高可用和可扩展的系统.扩展的方式可以是购买更好的服务器(纵向扩展(vertical scale or scaling up))或者购买更多的服务器(横向扩展 ...

  4. zookeeper启动错误 ---- Unable to load database on disk

    zk启动报错 解决办法,进入zkdata目录删除version-2下面的所有文件 参考: https://issues.apache.org/jira/browse/ZOOKEEPER-1546 [h ...

  5. ASP.NET MVC学习---(二)EF文件结构

    之前已经简单的介绍过ORM框架和EF 也了解了EF的种种优点 那么这个EF到底长啥样子都还没见过呢 别着急 接下来,科学教育频道--走近科学 带你走进EF的内心世界~ 那么接下来就是~ 等等等等... ...

  6. Chrome 完整版官方下载

    Chrome下载默认不是完整版本,需要长久等等.so... 在下载地址后加参数:?standalone=1  解决问题.

  7. jQuery.delegate() 函数详解

    delegate()函数用于为指定元素的一个或多个事件绑定事件处理函数. 此外,你还可以额外传递给事件处理函数一些所需的数据. 即使是执行delegate()函数之后新添加的元素,只要它符合条件,绑定 ...

  8. mongo: 索引

    索引创建 在学习索引之前,我们先看一下,如果没有添加索引时,我们用explain()函数,查看查询计划是什么样的. 发现使用的是BasicCursor,那么就代表我们没有索引,当我们查某一个数据的时候 ...

  9. [腾讯 TMQ] 零基础学习 Fiddler 抓包改包

    本文转载于https://testerhome.com/topics/7159 一.Fiddler1.1.简介Fiddler是一款HTTP协议调试代理工具,它能够抓取记录本机所有HTTP(S)请求,通 ...

  10. 我们常用的在a标签中有点击事件

    我们常用的在a标签中有点击事件:1. a href="javascript:js_method();" 这是我们平台上常用的方法,但是这种方法在传递this等参数的时候很容易出问题 ...