Emag eht htiw Em Pleh

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.|
+---+---+---+---+---+---+---+---+
题目大意:POJ2996的反向。输入2996的输出,输出2996的输入。
解题思路:
    1.定义结构体存每个格子的状态
    2.初始化结构体数组为“:::”||“...”    
    3.读取字符串,根据数据改变结构体的第二个变量
    4.格式输出
Code:
 #include<iostream>
#include<string>
using namespace std;
struct Point
{
char a,b,c;
} P[];
void Init()
{
int ok=;
for (int i=; i<=; i++)
{
if (ok) P[i].a=P[i].b=P[i].c=':';
else P[i].a=P[i].b=P[i].c='.';
if (i%) ok=!ok;
}
}
int main()
{
char x,y;
int i,j;
string White,Black;
string tmp="+---+---+---+---+---+---+---+---+";
getline(cin,White);
getline(cin,Black);
Init();
for (i=; i<=White.length()-; i++)
{
if (White[i]>='A'&&White[i]<='Z')
{
x=White[i+],y=White[i+];
P[(x--)*+(y-'a'+)].b=White[i];
}
else if (White[i-]==',')
{
x=White[i+],y=White[i];
P[(x--)*+(y-'a'+)].b='P';
}
}
for (i=; i<=Black.length()-; i++)
{
if (Black[i]>='A'&&Black[i]<='Z')
{
x=Black[i+],y=Black[i+];
P[(x--)*+(y-'a'+)].b=Black[i]+;
}
else if (Black[i-]==',')
{
x=Black[i+],y=Black[i];
P[(x--)*+(y-'a'+)].b='p';
}
}
cout<<tmp<<endl;
for (i=; i>=; i--)
{
cout<<'|';
for (j=; j<=; j++)
cout<<P[(i-)*+j].a<<P[(i-)*+j].b<<P[(i-)*+j].c<<'|';
cout<<endl;
cout<<tmp<<endl;
}
return ;
}

POJ2993——Emag eht htiw Em Pleh(字符串处理+排序)的更多相关文章

  1. 模拟 POJ 2993 Emag eht htiw Em Pleh

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

  2. Emag eht htiw Em Pleh(imitate)

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

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

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

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

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

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

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

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

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

  9. POJ 2993:Emag eht htiw Em Pleh

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

随机推荐

  1. ZigBee绑定细节

    ZigBee中的绑定由APS层来管理,除了绑定表管理外,APS层还有组表管理.快速地址查找等服务功能.应用层不能直接调用APS层中的数据服务来传输数据,只能通过AF层封装的AD_DataRequest ...

  2. jQuery父级以及同级元素查找介绍

    父级以及同级元素的查找在使用过程中还是蛮频繁的,下面为大家介绍下jQuery是如何实现的,感兴趣的朋友可以参考下: jQuery.parent(expr) 找父亲节点,可以传入expr进行过滤,比如$ ...

  3. .NET清楚Cookies

    foreach (string cookiename in Request.Cookies.AllKeys) { HttpCookie cookies = Request.Cookies[cookie ...

  4. 在Spring中使用cache(EhCache的对象缓存和页面缓存)

    Spring框架从version3.1开始支持cache,并在version4.1版本中对cache功能进行了增强. spring cache 的关键原理就是 spring AOP,通过 spring ...

  5. ldd查看可执行程序依赖的文件

    ldd 用于查看可执行程序依赖的so动态链接库文件 [root@localhost ld.so.conf.d]# ldd /usr/local/tengine/sbin/nginx linux-vds ...

  6. window下安装composer和laravel

    安装composer: 1.在https://getcomposer.org/download/ 中下载 Composer-Setup.exe 2.安装composer步骤如下: 至此,compose ...

  7. python学习之js从0开始

    <html> <head> <title>js页面</title> <script src="js/old_boy.js"&g ...

  8. String类源码分析(JDK1.7)

    以下学习根据JDK1.7String类源代码做注释 public final class String implements java.io.Serializable, Comparable<S ...

  9. Django文档——Model字段类型(Field Types)

    大部分内容参考自http://wrongwaycn.github.io/django11/topics/db/models/index.html#topics-db-models ,内容是django ...

  10. WPF中的文字修饰

    我们知道,文字的修饰包括:空心字.立体字.划线字.阴影字.加粗.倾斜等.这里只说划线字的修饰方式,按划线的位置,我们可将之分为:上划线.中划线.基线与下划线.如图: 从上至下,分别为上划线(Overl ...