链接:



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. wp8手机浏览器项目

    项目需求如下: 1.页面布局 最上方为搜索/网址框 中间为网页显示区,默认主页为百度搜索 最下方为功能栏,分别有后退,前进,窗口和更多功能 在更多功能中有 分享给好友 发送网址到桌面 查看历史记录等 ...

  2. 全双工音频播放器在c#中使用waveIn / waveOut api

    http://www.codeproject.com/Articles/4889/A-full-duplex-audio-player-in-C-using-the-waveIn-w 一篇关于低级音频 ...

  3. 向git库提交代码出现”There are no staged files"怎么办?

    1.选择菜单“Window”->"Preference" 2.左边树菜单选择“Team”->"Git"->"Committing&q ...

  4. dev_queue_xmit()函数返回值问题

    函数  dev_queue_xmit()用于直接使用sk_buf发包,此函数有返回值,但是并不能通过 此函数返回值为0来说明包已经发送出去且可以立刻释放sk_buff内存.因为网卡发包是一个异步的过程 ...

  5. Laravel之视图和Blade模板引擎

    一.视图 1.视图文件存放在resources/views目录2.视图载入及传参 return view('greeting', ['name' => 'James']); 还可以通过with ...

  6. NB的CSS样式集锦1——CSS3滚动条美化,CSS3滚动条皮肤

    转自:http://www.pengyaou.com/codecss3/POKDNMS_112.html CSS3 -webkit-scrollbar滚动条皮肤美化实现,利用-webkit-scrol ...

  7. JQuery find函数选择器使用

  8. 【ExtAspNet学习笔记】ExtAspNet控件库中常见问题

    1.在Grid控件中添加CheckBoxField控件,选择一行时,如何获取选择的CheckBoxField所对应记录的唯一标识值? ●解决方案: 在前台Grid控件中, 添加“<ext:Che ...

  9. java web 通配符* ? $1 $2 $3

    匹配通配符 * 匹配0-n个字符,但不包括“/”.即,“*”只匹配一级目录或文件中的零个或多个字符. ** 匹配0-n个字符,包括“/”.即,“**”匹配多级目录或文件. ? 匹配0-1个字符,但不包 ...

  10. 【已解决】ckfinder_php_3.4.4 IIS 报错 无效请求

    ckfinder_php_3.4.4 IIS 报错 无效请求 (Invalid request) Apache 正常,但是在IIS环境下报错,解决方法 设置 C:\Windows\Temp 目录 给 ...