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. Android自定义radiobutton(文字靠左,选框靠右)

    <RadioButton android:id="@+id/rb_never" android:layout_width="fill_parent" an ...

  2. ABAP 日期时间函数(转)

    转自:http://www.sapjx.com/abap-datetime-function.html 函数名称 (内页-点击名称可查看操作) 函数说明 备注 FIMA_DATE_CREATE RP_ ...

  3. Mysql分表教程

    一般来说,当我们的数据库的数据超过了100w记录的时候就应该考虑分表或者分区了,这次我来详细说说分表的一些方法.目前我所知道的方法都是MYISAM的,INNODB如何做分表并且保留事务和外键,我还不是 ...

  4. Ruby用法总结

    1.ruby中的整数.浮点数.字符串之间的相互转换 ruby的整数.浮点数.字符串的类均提供了to_i,to_f,to_s三个方法,分别用于转换成整数.转换成浮点数.转换成字符串. 2.数组的遍历 例 ...

  5. Python学习 之 文件

    1.文件读写 python进行文件读写的函数是open或file file_handler=open(filename,,mode) (1)打开并读取文件 方式一:open() fo=open('/r ...

  6. Helpers\GeoCode

    Helpers\GeoCode This function connects to google maps and retrieves the lat/lon of the address provi ...

  7. BootStrap2学习日记4---常用标签与样式

    <small>:常常和h1标签一起搭配使用 如<h1>标题<small>小标题</small></h1> <abbr>:abbr ...

  8. python(5)–sys模块

    sys.argv 命令行参数list, 第一个元素是程序本身路径 sys.exit(n) 退出程序,退出时输入信息n sys.version 获取python解释程序的版本信息 sys.maxint ...

  9. 关于eclipse中egit右键reset失败,无法更新git仓库.

    有时候egit出现莫名其妙的问题,这次是无法对git仓库进行reset . & & 解决方法: 找到对应git仓库的磁盘目录,然后进行git brash.(一定要安装了git客户端) ...

  10. 转:一个C语言实现的类似协程库(StateThreads)

    http://blog.csdn.net/win_lin/article/details/8242653 译文在后面. State Threads for Internet Applications ...