Time Limit: 1000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u

Submit Status

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

题意就是把2996的那道题的输出变输入,输入变输出。我觉得一下子变简单了很多,起码没那么多的麻烦事了。

思路就是现在是一个空棋盘,然后题目给了各个棋子的位置,拿这些棋子去占相应的位置,之后再输出占好各个位置的棋盘。

代码:

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#pragma warning(disable:4996)
using namespace std; const string temp="+---+---+---+---+---+---+---+---+";
string test[20];
string cal[5]; int i,len;
char row,col; int main()
{
test[1]="|...|:::|...|:::|...|:::|...|:::|";
test[2]="|:::|...|:::|...|:::|...|:::|...|";
test[3]="|...|:::|...|:::|...|:::|...|:::|";
test[4]="|:::|...|:::|...|:::|...|:::|...|";
test[5]="|...|:::|...|:::|...|:::|...|:::|";
test[6]="|:::|...|:::|...|:::|...|:::|...|";
test[7]="|...|:::|...|:::|...|:::|...|:::|";
test[8]="|:::|...|:::|...|:::|...|:::|...|"; cin>>cal[0];
cin>>cal[1];
cin>>cal[3];
cin>>cal[2]; len=cal[1].length();
for(i=0;i<len;i++)
{
if(cal[1][i]==',')continue;
else if(cal[1][i]=='K')
{
row=cal[1][i+1];
col=cal[1][i+2]; test[9-(col-'0')][(row-'a')*4+2]='K';
i=i+2;
}
else if(cal[1][i]=='Q')
{
row=cal[1][i+1];
col=cal[1][i+2]; test[9-(col-'0')][(row-'a')*4+2]='Q';
i=i+2;
}
else if(cal[1][i]=='R')
{
row=cal[1][i+1];
col=cal[1][i+2]; test[9-(col-'0')][(row-'a')*4+2]='R';
i=i+2;
}
else if(cal[1][i]=='B')
{
row=cal[1][i+1];
col=cal[1][i+2]; test[9-(col-'0')][(row-'a')*4+2]='B';
i=i+2;
}
else if(cal[1][i]=='N')
{
row=cal[1][i+1];
col=cal[1][i+2]; test[9-(col-'0')][(row-'a')*4+2]='N';
i=i+2;
}
else if(cal[1][i]>='a'&&cal[1][i]<='h')
{
row=cal[1][i];
col=cal[1][i+1]; test[9-(col-'0')][(row-'a')*4+2]='P';
i=i+1;
}
} len=cal[2].length();
for(i=0;i<len;i++)
{
if(cal[2][i]==',')continue;
else if(cal[2][i]=='K')
{
row=cal[2][i+1];
col=cal[2][i+2]; test[9-(col-'0')][(row-'a')*4+2]='k';
i=i+2;
}
else if(cal[2][i]=='Q')
{
row=cal[2][i+1];
col=cal[2][i+2]; test[9-(col-'0')][(row-'a')*4+2]='q';
i=i+2;
}
else if(cal[2][i]=='R')
{
row=cal[2][i+1];
col=cal[2][i+2]; test[9-(col-'0')][(row-'a')*4+2]='r';
i=i+2;
}
else if(cal[2][i]=='B')
{
row=cal[2][i+1];
col=cal[2][i+2]; test[9-(col-'0')][(row-'a')*4+2]='b';
i=i+2;
}
else if(cal[2][i]=='N')
{
row=cal[2][i+1];
col=cal[2][i+2]; test[9-(col-'0')][(row-'a')*4+2]='n';
i=i+2;
}
else if(cal[2][i]>='a'&&cal[2][i]<='h')
{
row=cal[2][i];
col=cal[2][i+1]; test[9-(col-'0')][(row-'a')*4+2]='p';
i=i+1;
}
} cout<<temp<<endl;
for(i=1;i<=8;i++)
{
cout<<test[i]<<endl;
cout<<temp<<endl;
} return 0;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

POJ 2993:Emag eht htiw Em Pleh的更多相关文章

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

  2. 模拟 POJ 2993 Emag eht htiw Em Pleh

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

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

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

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

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

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

  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. 模拟 + 打表 --- Emag eht htiw Em Pleh

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

随机推荐

  1. PE文件结构体-IMAGE_DATA_DIRECTORY

    IMAGE_OPTIONAL_HEADER结构体最后一个成员是数组结构,大小为16,每个元素都是一个IMAGE_DATA_DIRECTORY结构体 typedef struct _IMAGE_DATA ...

  2. 在 Scale Up 中使用 Health Check【转】

    对于多副本应用,当执行 Scale Up 操作时,新副本会作为 backend 被添加到 Service 的负载均衡中,与已有副本一起处理客户的请求.考虑到应用启动通常都需要一个准备阶段,比如加载缓存 ...

  3. [Codeforces #608 div2]1271A Suits

    Description A new delivery of clothing has arrived today to the clothing store. This delivery consis ...

  4. 029、Java中的四则运算

    01.代码如下: package TIANPAN; /** * 此处为文档注释 * * @author 田攀 微信382477247 */ public class TestDemo { public ...

  5. DateTimePicker控件在WinXP下的BUG

    如图,通过图示的按钮改变datetimepicker的值 ,弹出MessageBox, datetimePicker重新获得焦点后,自动重复点击按钮. 解决办法: new Thread(() => ...

  6. 京东首页如何实现pc端和移动端加载不同的html的?

    进入www.jd.com后代码判断是手机的话就跳转m.jd.com let ua = window.navigator.userAgent.toLocaleLowerCase() let murl = ...

  7. 修正png

    这是修正+取MD5的方法 function MD5FileTextPng(filename: AnsiString): AnsiString; var buf: ..MAX_PATH - ] of C ...

  8. JAVA笔记01 变量的取名

    第2章 有意义的命名2.1 介绍2.2 名副其实 变量名太随意,haha.list1.ok 这些都没啥意义2.3 避免误导 包含List等关键字.字母o与数字0等2.4 做有意义的区分 反面教材,变量 ...

  9. NIO 组件Buffer

    重要属性 属性 描述 Capacity 容量, 即可以容纳的最大数据量; 在缓冲区创建时被设定并且不能改变 Limit 表示缓冲区的当前终点, 不能对缓冲区超过极限的位置进行读写操作, 且极限是可以修 ...

  10. S7-200 smart输入输出接口试验

    工具 西门子 s7-200smart PLC 西门子s7-200 smart 试验 CPU型号是 SR30 这个 编译环境 符号 选择 了 "输入1"以后, 会自动的编地址为I0. ...