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. 使用python selenium进行自动化functional test

    Why Automation Testing 现在似乎大家都一致认同一个项目应该有足够多的测试来保证功能的正常运作,而且这些此处的‘测试’特指自动化测试:并且大多数人会认为如果还有哪个项目依然采用人工 ...

  2. 网络IPC:套接字

    网络进程间通信(network IPC):不同计算机(通过网络相连)上运行的进程相互通信的机制. 套接字网络IPC接口:进程能够使用该接口和其他进程通信.通过该接口,其他进程运行位置是透明的,它们可以 ...

  3. IOS应用程序多语言本地化解决方案

    最近要对一款游戏进行多语言本地化,在网上找了一些方案,加上自己的一点点想法整理出一套方案和大家分享! 多语言在应用程序中一般有两种做法:一.程序中提供给用户自己选择的机会:二.根据当前用户当前移动设备 ...

  4. Modified LCS

    Input Output Sample Input 3 5 3 4 15 3 1 10 2 2 7 3 3 100 1 1 100 1 2 Sample Output 4 3 50超时代码,因为K很大 ...

  5. [未完成]关于GUI Java图形化界

    "笔记内容完成,整体未完成" GUI 图形化用户界面 用java做图形化用户界面的程序不多,大多用C++和defy.因为,Java做图形化效率低. 首先你要安装一个虚拟机,C++是 ...

  6. MSP430常见问题之复位系统类

    Q1:请问msp430 怎么手动复位啊?是不是连到RST/NMI 上?但是这个脚不是和JTAG 连吗?我看到一些资料上说复位的话还要上拉电阻或者复位电路.A1:JTAG 功能只在下载程序时候使用,正常 ...

  7. Java反转单链表(code)

    主要是面试中可能会经常碰上该类似操作,尤其是稍大点公司,面试官可能并不在乎你能不能搞定该题,但是这类型题目最是能体现程序员的思维状态 ---一个迷糊头脑的程序员 怎能立志改变这个世界 /** * @a ...

  8. 嵌入式开发笔记 - U-Boot相关

    1.U-boot使用准备 1.1 U-boot下载 通过德国的denx软件中心提供的FTP下载合集,下载网址: ftp://ftp.denx.de/pub/u-boot/

  9. Windows 7 IE11 F12 不能正常使用

    打开任意网站,按下F12,或者右键鼠标,按L键.出现上面的图的情况!解决办法如下:需要安装下面的补丁(KB3008923) 32位系统:http://www.microsoft.com/en-us/d ...

  10. 【高性能服务器】Nginx剖析

    引言 Nginx是一个流行的高性能服务器,官方宣称在压力测试下可以支持5万个并发连接,而且占用内存极低.相比于其他昂贵的硬件负载均衡解决方案,Nginx是开源免费的,可以大大降低成本.本文将从一下几个 ...