1.Link:

http://poj.org/problem?id=2993

2.Content:

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

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

3.Method:

模拟题,我的方法是想把棋盘初始化好,然后再往里面添棋子

由于很简单,就没有把white和black统一为一种情况,代码不怎么精简

不过对于水题,已经足够了

4.Code:

 #include <iostream>
#include <string> using namespace std; int main()
{
//freopen("D://input.txt","r",stdin); int i,j; //init output
string str_out[ + ];
str_out[] = "+---+---+---+---+---+---+---+---+";
for(i = ; i < ; ++i)
{
str_out[i * + ] = "|";
for(j = ; j < ; ++j)
{
if((i + j) % == ) str_out[i * + ] += "...";
else str_out[i * + ] += ":::";
str_out[i * + ] += "|";
}
str_out[(i + ) * ] = "+---+---+---+---+---+---+---+---+";
} string str; //white:
cin >> str;
cin >> str; str = "," + str; //cout << str << endl;
int arr_ch[] = {'K','Q','R','B','N'}; string::size_type str_i;
for(str_i = ; str_i != str.size(); ++str_i)
{
if(str[str_i] == ',')
{
for(i = ; i < ; ++i) if(str[str_i + ] == arr_ch[i]) break;
if(i < )
{
str_out[( - (str[str_i + ] - '')) * + ][ + * (str[str_i + ] - 'a')] = arr_ch[i];
}
else
{
str_out[( - (str[str_i + ] - '')) * + ][ + * (str[str_i + ] - 'a')] = 'P';
}
}
} //black:
cin >> str;
cin >> str;
str = "," + str; //cout << str << endl; for(str_i = ; str_i != str.size(); ++str_i)
{
if(str[str_i] == ',')
{
for(i = ; i < ; ++i) if(str[str_i + ] == arr_ch[i]) break;
if(i < )
{
str_out[( - (str[str_i + ] - '')) * + ][ + * (str[str_i + ] - 'a')] = arr_ch[i] + ('a' - 'A');
}
else
{
str_out[( - (str[str_i + ] - '')) * + ][ + * (str[str_i + ] - 'a')] = 'p';
}
}
} for(i = ; i < ; ++i) cout << str_out[i] << endl; //fclose(stdin); return ;
}

5.Reference:

Poj 2993 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. 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 This problem is a reverse case of the problem 2996. You are given the output o ...

  8. Emag eht htiw Em Pleh(imitate)

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

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

随机推荐

  1. Adobe Texture Format

    ATF : Adobe Texture Format. 这是一种能提供最佳压缩效果的文件格式. ATF文件主要是一个存储有损纹理数据(lossy texture data)的文件容器.它主要使用了两种 ...

  2. 高并发网络编程之epoll详解

    select.poll和epoll的区别 在linux没有实现epoll事件驱动机制之前,我们一般选择用select或者poll等IO多路复用的方法来实现并发服务程序.在大数据.高并发.集群等一些名词 ...

  3. Kruskal算法 Swordfish

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=203 Swordfish Time Limit: 2 Seconds      ...

  4. Emacs 配置 Python 编程环境

    python编程环境设置涉及到:自动完成.语法检查.虚拟环境. 为了不把系统搞乱,在python的虚拟环境中安装相关的插件. 一.安装python虚拟环境 virtualenvwrapper sudo ...

  5. sql 自定义函数--固定格式字符转时间类型

    遇到一个德国的客户,他们的时间格式是JJJJ-TT-DD HH:MM:SS,程序按照这个格式将时间插入数据库,但是在sql自带的转换函数convert.cast过程中报错,网上搜了下都说用conver ...

  6. CentOS(二)--初识linux的一些常用命令

    linux命令是对Linux系统进行管理的命令.对于Linux系统来说,无论是中央处理器.内存.磁盘驱动器.键盘.鼠标,还是用户等都是文件,Linux系统管理的命令是它正常运行的核心,与之前的DOS命 ...

  7. Linux上安装MPEG-1 Layer3(mp3)解码器

    今天突然想要在linux上播放音乐,但是打开之后发现缺少了解码器 于是去网上找了解决的方法,说得天花乱坠,不过有个帖子给出了很简单的方法. 以下内容转载于网络 上面提示没有安装解码器,这是因为版权问题 ...

  8. Telnet客户端连接服务器,看不见字符,只显示横线

    Telnet 窗口看不见字符,只显示小横线 在用telnet连接tomcat服务器的 时候,窗口中不显示字符,显示成一个一个的横线 解决办法: 按住“Ctrl+]” 回车解决问题

  9. JS中获取table节点的tr或td的内容

    <table id="tb1" width="200" border="1" cellpadding="4" ce ...

  10. Oracle启动的整个过程

    1.启动选项 在发出startup命令启动数据库时,oracle将在默认位置$ORACLE_HOME/dbs(UNIX/Linux)中查找初始化参数文件.Oracle将以下面的顺序在其中寻找合适的初始 ...